Skip to content

Commit

Permalink
Use LLVMDIBuilderCreateDebugLocation
Browse files Browse the repository at this point in the history
  • Loading branch information
Zalathar committed Jan 3, 2025
1 parent 94a7e6e commit b60a737
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/debuginfo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ impl<'ll, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
(line, col)
};

unsafe { llvm::LLVMRustDIBuilderCreateDebugLocation(line, col, scope, inlined_at) }
unsafe { llvm::LLVMDIBuilderCreateDebugLocation(self.llcx, line, col, scope, inlined_at) }
}

fn create_vtable_debuginfo(
Expand Down
14 changes: 8 additions & 6 deletions compiler/rustc_codegen_llvm/src/llvm/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1646,6 +1646,14 @@ unsafe extern "C" {
File: &'ll Metadata,
Discriminator: c_uint, // (optional "DWARF path discriminator"; default is 0)
) -> &'ll Metadata;

pub(crate) fn LLVMDIBuilderCreateDebugLocation<'ll>(
Ctx: &'ll Context,
Line: c_uint,
Column: c_uint,
Scope: &'ll Metadata,
InlinedAt: Option<&'ll Metadata>,
) -> &'ll Metadata;
}

#[link(name = "llvm-wrapper", kind = "static")]
Expand Down Expand Up @@ -2202,12 +2210,6 @@ unsafe extern "C" {
Params: Option<&'a DIArray>,
);

pub fn LLVMRustDIBuilderCreateDebugLocation<'a>(
Line: c_uint,
Column: c_uint,
Scope: &'a DIScope,
InlinedAt: Option<&'a DILocation>,
) -> &'a DILocation;
pub fn LLVMRustDILocationCloneWithBaseDiscriminator<'a>(
Location: &'a DILocation,
BD: c_uint,
Expand Down
10 changes: 0 additions & 10 deletions compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1288,16 +1288,6 @@ extern "C" void LLVMRustDICompositeTypeReplaceArrays(
DINodeArray(unwrap<MDTuple>(Params)));
}

extern "C" LLVMMetadataRef
LLVMRustDIBuilderCreateDebugLocation(unsigned Line, unsigned Column,
LLVMMetadataRef ScopeRef,
LLVMMetadataRef InlinedAt) {
MDNode *Scope = unwrapDIPtr<MDNode>(ScopeRef);
DILocation *Loc = DILocation::get(Scope->getContext(), Line, Column, Scope,
unwrapDIPtr<MDNode>(InlinedAt));
return wrap(Loc);
}

extern "C" LLVMMetadataRef
LLVMRustDILocationCloneWithBaseDiscriminator(LLVMMetadataRef Location,
unsigned BD) {
Expand Down

0 comments on commit b60a737

Please sign in to comment.