Skip to content

Commit 949b467

Browse files
committed
Use LLVMDIBuilderCreateLexicalBlockFile
1 parent 70d41bc commit 949b467

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1641,7 +1641,14 @@ pub(crate) fn extend_scope_to_file<'ll>(
16411641
file: &SourceFile,
16421642
) -> &'ll DILexicalBlock {
16431643
let file_metadata = file_metadata(cx, file);
1644-
unsafe { llvm::LLVMRustDIBuilderCreateLexicalBlockFile(DIB(cx), scope_metadata, file_metadata) }
1644+
unsafe {
1645+
llvm::LLVMDIBuilderCreateLexicalBlockFile(
1646+
DIB(cx),
1647+
scope_metadata,
1648+
file_metadata,
1649+
/* Discriminator (default) */ 0u32,
1650+
)
1651+
}
16451652
}
16461653

16471654
fn tuple_field_name(field_index: usize) -> Cow<'static, str> {

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ use rustc_target::spec::SymbolVisibility;
1313
use super::RustString;
1414
use super::debuginfo::{
1515
DIArray, DIBasicType, DIBuilder, DICompositeType, DIDerivedType, DIDescriptor, DIEnumerator,
16-
DIFile, DIFlags, DIGlobalVariableExpression, DILexicalBlock, DILocation, DISPFlags, DIScope,
17-
DISubprogram, DISubrange, DITemplateTypeParameter, DIType, DIVariable, DebugEmissionKind,
18-
DebugNameTableKind,
16+
DIFile, DIFlags, DIGlobalVariableExpression, DILocation, DISPFlags, DIScope, DISubprogram,
17+
DISubrange, DITemplateTypeParameter, DIType, DIVariable, DebugEmissionKind, DebugNameTableKind,
1918
};
2019
use crate::llvm;
2120

@@ -1734,6 +1733,13 @@ unsafe extern "C" {
17341733
Line: c_uint,
17351734
Column: c_uint,
17361735
) -> &'ll Metadata;
1736+
1737+
pub(crate) fn LLVMDIBuilderCreateLexicalBlockFile<'ll>(
1738+
Builder: &DIBuilder<'ll>,
1739+
Scope: &'ll Metadata,
1740+
File: &'ll Metadata,
1741+
Discriminator: c_uint, // (optional "DWARF path discriminator"; default is 0)
1742+
) -> &'ll Metadata;
17371743
}
17381744

17391745
#[link(name = "llvm-wrapper", kind = "static")]
@@ -2165,12 +2171,6 @@ unsafe extern "C" {
21652171
Type: &'a DIType,
21662172
) -> &'a DIDerivedType;
21672173

2168-
pub fn LLVMRustDIBuilderCreateLexicalBlockFile<'a>(
2169-
Builder: &DIBuilder<'a>,
2170-
Scope: &'a DIScope,
2171-
File: &'a DIFile,
2172-
) -> &'a DILexicalBlock;
2173-
21742174
pub fn LLVMRustDIBuilderCreateStaticVariable<'a>(
21752175
Builder: &DIBuilder<'a>,
21762176
Context: Option<&'a DIScope>,

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,12 +1179,6 @@ LLVMRustDIBuilderCreateQualifiedType(LLVMDIBuilderRef Builder, unsigned Tag,
11791179
unwrap(Builder)->createQualifiedType(Tag, unwrapDI<DIType>(Type)));
11801180
}
11811181

1182-
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateLexicalBlockFile(
1183-
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef File) {
1184-
return wrap(unwrap(Builder)->createLexicalBlockFile(
1185-
unwrapDI<DIDescriptor>(Scope), unwrapDI<DIFile>(File)));
1186-
}
1187-
11881182
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateStaticVariable(
11891183
LLVMDIBuilderRef Builder, LLVMMetadataRef Context, const char *Name,
11901184
size_t NameLen, const char *LinkageName, size_t LinkageNameLen,

0 commit comments

Comments
 (0)