Skip to content

Commit 0704914

Browse files
committed
Use LLVMDIBuilderCreateBasicType
1 parent 4115c7a commit 0704914

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
@@ -1694,6 +1694,15 @@ unsafe extern "C" {
16941694
Subscripts: *const &'ll Metadata,
16951695
NumSubscripts: c_uint,
16961696
) -> &'ll Metadata;
1697+
1698+
pub(crate) fn LLVMDIBuilderCreateBasicType<'ll>(
1699+
Builder: &DIBuilder<'ll>,
1700+
Name: *const c_uchar,
1701+
NameLen: size_t,
1702+
SizeInBits: u64,
1703+
Encoding: c_uint, // `LLVMDWARFTypeEncoding`
1704+
Flags: DIFlags,
1705+
) -> &'ll Metadata;
16971706
}
16981707

16991708
#[link(name = "llvm-wrapper", kind = "static")]
@@ -2026,14 +2035,6 @@ unsafe extern "C" {
20262035
TParam: &'a DIArray,
20272036
) -> &'a DISubprogram;
20282037

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

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

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

970-
extern "C" LLVMMetadataRef
971-
LLVMRustDIBuilderCreateBasicType(LLVMRustDIBuilderRef Builder, const char *Name,
972-
size_t NameLen, uint64_t SizeInBits,
973-
unsigned Encoding) {
974-
return wrap(
975-
Builder->createBasicType(StringRef(Name, NameLen), SizeInBits, Encoding));
976-
}
977-
978970
extern "C" LLVMMetadataRef
979971
LLVMRustDIBuilderCreateTypedef(LLVMRustDIBuilderRef Builder,
980972
LLVMMetadataRef Type, const char *Name,

0 commit comments

Comments
 (0)