Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 8ddd9c3

Browse files
committed
Use LLVMDIBuilderCreateDebugLocation
The LLVM-C binding takes an explicit context, whereas our binding obtained the context from the scope argument.
1 parent 949b467 commit 8ddd9c3

File tree

3 files changed

+9
-17
lines changed

3 files changed

+9
-17
lines changed

compiler/rustc_codegen_llvm/src/debuginfo/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ impl<'ll, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
574574
(line, col)
575575
};
576576

577-
unsafe { llvm::LLVMRustDIBuilderCreateDebugLocation(line, col, scope, inlined_at) }
577+
unsafe { llvm::LLVMDIBuilderCreateDebugLocation(self.llcx, line, col, scope, inlined_at) }
578578
}
579579

580580
fn create_vtable_debuginfo(

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,6 +1740,14 @@ unsafe extern "C" {
17401740
File: &'ll Metadata,
17411741
Discriminator: c_uint, // (optional "DWARF path discriminator"; default is 0)
17421742
) -> &'ll Metadata;
1743+
1744+
pub(crate) fn LLVMDIBuilderCreateDebugLocation<'ll>(
1745+
Ctx: &'ll Context,
1746+
Line: c_uint,
1747+
Column: c_uint,
1748+
Scope: &'ll Metadata,
1749+
InlinedAt: Option<&'ll Metadata>,
1750+
) -> &'ll Metadata;
17431751
}
17441752

17451753
#[link(name = "llvm-wrapper", kind = "static")]
@@ -2302,12 +2310,6 @@ unsafe extern "C" {
23022310
Params: Option<&'a DIArray>,
23032311
);
23042312

2305-
pub fn LLVMRustDIBuilderCreateDebugLocation<'a>(
2306-
Line: c_uint,
2307-
Column: c_uint,
2308-
Scope: &'a DIScope,
2309-
InlinedAt: Option<&'a DILocation>,
2310-
) -> &'a DILocation;
23112313
pub fn LLVMRustDILocationCloneWithBaseDiscriminator<'a>(
23122314
Location: &'a DILocation,
23132315
BD: c_uint,

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,16 +1315,6 @@ extern "C" void LLVMRustDICompositeTypeReplaceArrays(
13151315
DINodeArray(unwrap<MDTuple>(Params)));
13161316
}
13171317

1318-
extern "C" LLVMMetadataRef
1319-
LLVMRustDIBuilderCreateDebugLocation(unsigned Line, unsigned Column,
1320-
LLVMMetadataRef ScopeRef,
1321-
LLVMMetadataRef InlinedAt) {
1322-
MDNode *Scope = unwrapDIPtr<MDNode>(ScopeRef);
1323-
DILocation *Loc = DILocation::get(Scope->getContext(), Line, Column, Scope,
1324-
unwrapDIPtr<MDNode>(InlinedAt));
1325-
return wrap(Loc);
1326-
}
1327-
13281318
extern "C" LLVMMetadataRef
13291319
LLVMRustDILocationCloneWithBaseDiscriminator(LLVMMetadataRef Location,
13301320
unsigned BD) {

0 commit comments

Comments
 (0)