Skip to content

Commit 3e9048d

Browse files
committed
Use LLVMDIBuilderCreateBasicType
1 parent bef8f64 commit 3e9048d

File tree

3 files changed

+12
-18
lines changed

3 files changed

+12
-18
lines changed

compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -840,12 +840,13 @@ fn create_basic_type<'ll, 'tcx>(
840840
encoding: u32,
841841
) -> &'ll DIBasicType {
842842
unsafe {
843-
llvm::LLVMRustDIBuilderCreateBasicType(
843+
llvm::LLVMDIBuilderCreateBasicType(
844844
DIB(cx),
845-
name.as_c_char_ptr(),
845+
name.as_ptr(),
846846
name.len(),
847847
size.bits(),
848848
encoding,
849+
DIFlags::FlagZero,
849850
)
850851
}
851852
}

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1904,6 +1904,15 @@ unsafe extern "C" {
19041904
Subscripts: *const &'ll Metadata,
19051905
NumSubscripts: c_uint,
19061906
) -> &'ll Metadata;
1907+
1908+
pub(crate) fn LLVMDIBuilderCreateBasicType<'ll>(
1909+
Builder: &DIBuilder<'ll>,
1910+
Name: *const c_uchar, // See "PTR_LEN_STR".
1911+
NameLen: size_t,
1912+
SizeInBits: u64,
1913+
Encoding: c_uint, // (`LLVMDWARFTypeEncoding`)
1914+
Flags: DIFlags, // (default is `DIFlags::DIFlagZero`)
1915+
) -> &'ll Metadata;
19071916
}
19081917

19091918
#[link(name = "llvm-wrapper", kind = "static")]
@@ -2239,14 +2248,6 @@ unsafe extern "C" {
22392248
TParam: &'a DIArray,
22402249
) -> &'a DISubprogram;
22412250

2242-
pub(crate) fn LLVMRustDIBuilderCreateBasicType<'a>(
2243-
Builder: &DIBuilder<'a>,
2244-
Name: *const c_char,
2245-
NameLen: size_t,
2246-
SizeInBits: u64,
2247-
Encoding: c_uint,
2248-
) -> &'a DIBasicType;
2249-
22502251
pub(crate) fn LLVMRustDIBuilderCreateTypedef<'a>(
22512252
Builder: &DIBuilder<'a>,
22522253
Type: &'a DIBasicType,

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,14 +1064,6 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateMethod(
10641064
return wrap(Sub);
10651065
}
10661066

1067-
extern "C" LLVMMetadataRef
1068-
LLVMRustDIBuilderCreateBasicType(LLVMDIBuilderRef Builder, const char *Name,
1069-
size_t NameLen, uint64_t SizeInBits,
1070-
unsigned Encoding) {
1071-
return wrap(unwrap(Builder)->createBasicType(StringRef(Name, NameLen),
1072-
SizeInBits, Encoding));
1073-
}
1074-
10751067
extern "C" LLVMMetadataRef
10761068
LLVMRustDIBuilderCreateTypedef(LLVMDIBuilderRef Builder, LLVMMetadataRef Type,
10771069
const char *Name, size_t NameLen,

0 commit comments

Comments
 (0)