Skip to content

Commit 6596c94

Browse files
committed
Use LLVMDIBuilderCreateBasicType
1 parent 6230db2 commit 6596c94

File tree

3 files changed

+15
-20
lines changed

3 files changed

+15
-20
lines changed

compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -516,12 +516,13 @@ fn recursion_marker_type_di_node<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>) -> &'ll D
516516
// FIXME: it might make sense to use an actual pointer type here
517517
// so that debuggers can show the address.
518518
let name = "<recur_type>";
519-
llvm::LLVMRustDIBuilderCreateBasicType(
519+
llvm::LLVMDIBuilderCreateBasicType(
520520
DIB(cx),
521-
name.as_c_char_ptr(),
521+
name.as_ptr(),
522522
name.len(),
523523
cx.tcx.data_layout.pointer_size.bits(),
524524
DW_ATE_unsigned,
525+
DIFlags::FlagZero,
525526
)
526527
}
527528
})
@@ -804,12 +805,13 @@ fn build_basic_type_di_node<'ll, 'tcx>(
804805
};
805806

806807
let ty_di_node = unsafe {
807-
llvm::LLVMRustDIBuilderCreateBasicType(
808+
llvm::LLVMDIBuilderCreateBasicType(
808809
DIB(cx),
809-
name.as_c_char_ptr(),
810+
name.as_ptr(),
810811
name.len(),
811812
cx.size_of(t).bits(),
812813
encoding,
814+
DIFlags::FlagZero,
813815
)
814816
};
815817

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,6 +1696,15 @@ unsafe extern "C" {
16961696
Subscripts: *const &'ll Metadata,
16971697
NumSubscripts: c_uint,
16981698
) -> &'ll Metadata;
1699+
1700+
pub(crate) fn LLVMDIBuilderCreateBasicType<'ll>(
1701+
Builder: &DIBuilder<'ll>,
1702+
Name: *const c_uchar,
1703+
NameLen: size_t,
1704+
SizeInBits: u64,
1705+
Encoding: c_uint, // `LLVMDWARFTypeEncoding`
1706+
Flags: DIFlags, // (optional; default is `DIFlags::FlagZero`)
1707+
) -> &'ll Metadata;
16991708
}
17001709

17011710
#[link(name = "llvm-wrapper", kind = "static")]
@@ -2028,14 +2037,6 @@ unsafe extern "C" {
20282037
TParam: &'a DIArray,
20292038
) -> &'a DISubprogram;
20302039

2031-
pub fn LLVMRustDIBuilderCreateBasicType<'a>(
2032-
Builder: &DIBuilder<'a>,
2033-
Name: *const c_char,
2034-
NameLen: size_t,
2035-
SizeInBits: u64,
2036-
Encoding: c_uint,
2037-
) -> &'a DIBasicType;
2038-
20392040
pub fn LLVMRustDIBuilderCreateTypedef<'a>(
20402041
Builder: &DIBuilder<'a>,
20412042
Type: &'a DIBasicType,

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

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

983-
extern "C" LLVMMetadataRef
984-
LLVMRustDIBuilderCreateBasicType(LLVMRustDIBuilderRef Builder, const char *Name,
985-
size_t NameLen, uint64_t SizeInBits,
986-
unsigned Encoding) {
987-
return wrap(
988-
Builder->createBasicType(StringRef(Name, NameLen), SizeInBits, Encoding));
989-
}
990-
991983
extern "C" LLVMMetadataRef
992984
LLVMRustDIBuilderCreateTypedef(LLVMRustDIBuilderRef Builder,
993985
LLVMMetadataRef Type, const char *Name,

0 commit comments

Comments
 (0)