Skip to content

Commit

Permalink
Explain why the DW_TAG_* constants remain as-is for now
Browse files Browse the repository at this point in the history
  • Loading branch information
Zalathar committed Jan 5, 2025
1 parent 7bd31e2 commit 9b6c780
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 4 additions & 0 deletions compiler/rustc_codegen_llvm/src/debuginfo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
4 changes: 1 addition & 3 deletions compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 9b6c780

Please sign in to comment.