From 9b6c780265c0078bcc57edfa5878bdaf63ab4f3e Mon Sep 17 00:00:00 2001 From: Zalathar Date: Sun, 5 Jan 2025 12:31:41 +1100 Subject: [PATCH] Explain why the `DW_TAG_*` constants remain as-is for now --- compiler/rustc_codegen_llvm/src/debuginfo/mod.rs | 4 ++++ compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs b/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs index cb18f3cd78bf8..755f4816acf98 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs @@ -48,6 +48,10 @@ mod utils; use self::create_scope_map::compute_mir_scopes; pub(crate) use self::metadata::build_global_var_di_node; +// FIXME(Zalathar): These `DW_TAG_*` constants are fake values that were +// removed from LLVM in 2015, and are only used by our own `RustWrapper.cpp` +// to decide which C++ API to call. Instead, we should just have two separate +// FFI functions and choose the correct one on the Rust side. #[allow(non_upper_case_globals)] const DW_TAG_auto_variable: c_uint = 0x100; #[allow(non_upper_case_globals)] diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index 1236622fecec1..f55ef5a9b445c 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -56,9 +56,7 @@ using namespace llvm::object; // This opcode is an LLVM detail that could hypothetically change, so verify // that the hard-coded value in `dwarf_const.rs` still agrees with LLVM. -static_assert( - dwarf::DW_OP_LLVM_fragment == 0x1000, - "DW_OP_LLVM_fragment has changed from the value used by Rust-side code"); +static_assert(dwarf::DW_OP_LLVM_fragment == 0x1000); // LLVMAtomicOrdering is already an enum - don't create another // one.