Skip to content

Commit 73129be

Browse files
committed
Use LLVMDIBuilderCreateBasicType
1 parent 03224ee commit 73129be

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
@@ -515,12 +515,13 @@ fn recursion_marker_type_di_node<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>) -> &'ll D
515515
// FIXME: it might make sense to use an actual pointer type here
516516
// so that debuggers can show the address.
517517
let name = "<recur_type>";
518-
llvm::LLVMRustDIBuilderCreateBasicType(
518+
llvm::LLVMDIBuilderCreateBasicType(
519519
DIB(cx),
520-
name.as_c_char_ptr(),
520+
name.as_ptr(),
521521
name.len(),
522522
cx.tcx.data_layout.pointer_size.bits(),
523523
DW_ATE_unsigned,
524+
DIFlags::FlagZero,
524525
)
525526
}
526527
})
@@ -803,12 +804,13 @@ fn build_basic_type_di_node<'ll, 'tcx>(
803804
};
804805

805806
let ty_di_node = unsafe {
806-
llvm::LLVMRustDIBuilderCreateBasicType(
807+
llvm::LLVMDIBuilderCreateBasicType(
807808
DIB(cx),
808-
name.as_c_char_ptr(),
809+
name.as_ptr(),
809810
name.len(),
810811
cx.size_of(t).bits(),
811812
encoding,
813+
DIFlags::FlagZero,
812814
)
813815
};
814816

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

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

17031712
#[link(name = "llvm-wrapper", kind = "static")]
@@ -2030,14 +2039,6 @@ unsafe extern "C" {
20302039
TParam: &'a DIArray,
20312040
) -> &'a DISubprogram;
20322041

2033-
pub fn LLVMRustDIBuilderCreateBasicType<'a>(
2034-
Builder: &DIBuilder<'a>,
2035-
Name: *const c_char,
2036-
NameLen: size_t,
2037-
SizeInBits: u64,
2038-
Encoding: c_uint,
2039-
) -> &'a DIBasicType;
2040-
20412042
pub fn LLVMRustDIBuilderCreateTypedef<'a>(
20422043
Builder: &DIBuilder<'a>,
20432044
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)