Skip to content

Commit 31bc8ac

Browse files
committed
Use LLVMDIBuilderCreateTypedef
1 parent 6cfe10d commit 31bc8ac

File tree

3 files changed

+17
-25
lines changed

3 files changed

+17
-25
lines changed

compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -827,14 +827,15 @@ fn build_basic_type_di_node<'ll, 'tcx>(
827827
};
828828

829829
let typedef_di_node = unsafe {
830-
llvm::LLVMRustDIBuilderCreateTypedef(
830+
llvm::LLVMDIBuilderCreateTypedef(
831831
DIB(cx),
832832
ty_di_node,
833-
typedef_name.as_c_char_ptr(),
833+
typedef_name.as_ptr(),
834834
typedef_name.len(),
835835
unknown_file_metadata(cx),
836-
0,
837-
None,
836+
/* LineNo */ 0,
837+
/* Scope */ None,
838+
/* AlignInBits (optional) */ 0,
838839
)
839840
};
840841

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_target::spec::SymbolVisibility;
1111

1212
use super::RustString;
1313
use super::debuginfo::{
14-
DIArray, DIBasicType, DIBuilder, DIDerivedType, DIDescriptor, DIEnumerator, DIFile, DIFlags,
14+
DIArray, DIBuilder, DIDerivedType, DIDescriptor, DIEnumerator, DIFile, DIFlags,
1515
DIGlobalVariableExpression, DILocation, DISPFlags, DIScope, DISubprogram, DISubrange,
1616
DITemplateTypeParameter, DIType, DIVariable, DebugEmissionKind, DebugNameTableKind,
1717
};
@@ -1759,6 +1759,17 @@ unsafe extern "C" {
17591759
ConstantVal: Option<&'ll Value>,
17601760
AlignInBits: u32,
17611761
) -> &'ll Metadata;
1762+
1763+
pub(crate) fn LLVMDIBuilderCreateTypedef<'ll>(
1764+
Builder: &DIBuilder<'ll>,
1765+
Type: &'ll Metadata,
1766+
Name: *const c_uchar,
1767+
NameLen: size_t,
1768+
File: &'ll Metadata,
1769+
LineNo: c_uint,
1770+
Scope: Option<&'ll Metadata>,
1771+
AlignInBits: u32, // (optional; default is 0)
1772+
) -> &'ll Metadata;
17621773
}
17631774

17641775
#[link(name = "llvm-wrapper", kind = "static")]
@@ -2091,16 +2102,6 @@ unsafe extern "C" {
20912102
TParam: &'a DIArray,
20922103
) -> &'a DISubprogram;
20932104

2094-
pub fn LLVMRustDIBuilderCreateTypedef<'a>(
2095-
Builder: &DIBuilder<'a>,
2096-
Type: &'a DIBasicType,
2097-
Name: *const c_char,
2098-
NameLen: size_t,
2099-
File: &'a DIFile,
2100-
LineNo: c_uint,
2101-
Scope: Option<&'a DIScope>,
2102-
) -> &'a DIDerivedType;
2103-
21042105
pub fn LLVMRustDIBuilderCreateVariantMemberType<'a>(
21052106
Builder: &DIBuilder<'a>,
21062107
Scope: &'a DIScope,

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -967,16 +967,6 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateMethod(
967967
return wrap(Sub);
968968
}
969969

970-
extern "C" LLVMMetadataRef
971-
LLVMRustDIBuilderCreateTypedef(LLVMRustDIBuilderRef Builder,
972-
LLVMMetadataRef Type, const char *Name,
973-
size_t NameLen, LLVMMetadataRef File,
974-
unsigned LineNo, LLVMMetadataRef Scope) {
975-
return wrap(Builder->createTypedef(
976-
unwrap<DIType>(Type), StringRef(Name, NameLen), unwrap<DIFile>(File),
977-
LineNo, unwrapDIPtr<DIScope>(Scope)));
978-
}
979-
980970
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateVariantPart(
981971
LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
982972
size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,

0 commit comments

Comments
 (0)