Skip to content

Commit 0602787

Browse files
committed
Use LLVMDIBuilderCreateTypedef
1 parent b4838a9 commit 0602787

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 */ 0u32,
837+
/* Scope */ None,
838+
/* AlignInBits (optional) */ 0u32,
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
};
@@ -1761,6 +1761,17 @@ unsafe extern "C" {
17611761
ConstantVal: Option<&'ll Value>,
17621762
AlignInBits: u32,
17631763
) -> &'ll Metadata;
1764+
1765+
pub(crate) fn LLVMDIBuilderCreateTypedef<'ll>(
1766+
Builder: &DIBuilder<'ll>,
1767+
Type: &'ll Metadata,
1768+
Name: *const c_uchar,
1769+
NameLen: size_t,
1770+
File: &'ll Metadata,
1771+
LineNo: c_uint,
1772+
Scope: Option<&'ll Metadata>,
1773+
AlignInBits: u32, // (optional; default is 0)
1774+
) -> &'ll Metadata;
17641775
}
17651776

17661777
#[link(name = "llvm-wrapper", kind = "static")]
@@ -2093,16 +2104,6 @@ unsafe extern "C" {
20932104
TParam: &'a DIArray,
20942105
) -> &'a DISubprogram;
20952106

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

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -980,16 +980,6 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateMethod(
980980
return wrap(Sub);
981981
}
982982

983-
extern "C" LLVMMetadataRef
984-
LLVMRustDIBuilderCreateTypedef(LLVMRustDIBuilderRef Builder,
985-
LLVMMetadataRef Type, const char *Name,
986-
size_t NameLen, LLVMMetadataRef File,
987-
unsigned LineNo, LLVMMetadataRef Scope) {
988-
return wrap(Builder->createTypedef(
989-
unwrap<DIType>(Type), StringRef(Name, NameLen), unwrap<DIFile>(File),
990-
LineNo, unwrapDIPtr<DIScope>(Scope)));
991-
}
992-
993983
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateVariantPart(
994984
LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
995985
size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,

0 commit comments

Comments
 (0)