Skip to content

Commit 50194be

Browse files
committed
Use LLVMDIBuilderCreatePointerType
1 parent 6596c94 commit 50194be

File tree

3 files changed

+15
-24
lines changed

3 files changed

+15
-24
lines changed

compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,13 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
180180
);
181181

182182
let di_node = unsafe {
183-
llvm::LLVMRustDIBuilderCreatePointerType(
183+
llvm::LLVMDIBuilderCreatePointerType(
184184
DIB(cx),
185185
pointee_type_di_node,
186186
data_layout.pointer_size.bits(),
187187
data_layout.pointer_align.abi.bits() as u32,
188188
0, // Ignore DWARF address space.
189-
ptr_type_debuginfo_name.as_c_char_ptr(),
189+
ptr_type_debuginfo_name.as_ptr(),
190190
ptr_type_debuginfo_name.len(),
191191
)
192192
};
@@ -238,7 +238,7 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
238238
// The data pointer type is a regular, thin pointer, regardless of whether this
239239
// is a slice or a trait object.
240240
let data_ptr_type_di_node = unsafe {
241-
llvm::LLVMRustDIBuilderCreatePointerType(
241+
llvm::LLVMDIBuilderCreatePointerType(
242242
DIB(cx),
243243
pointee_type_di_node,
244244
addr_field.size.bits(),
@@ -343,13 +343,13 @@ fn build_subroutine_type_di_node<'ll, 'tcx>(
343343
_ => unreachable!(),
344344
};
345345
let di_node = unsafe {
346-
llvm::LLVMRustDIBuilderCreatePointerType(
346+
llvm::LLVMDIBuilderCreatePointerType(
347347
DIB(cx),
348348
fn_di_node,
349349
size,
350350
align,
351351
0, // Ignore DWARF address space.
352-
name.as_c_char_ptr(),
352+
name.as_ptr(),
353353
name.len(),
354354
)
355355
};

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,6 +1705,16 @@ unsafe extern "C" {
17051705
Encoding: c_uint, // `LLVMDWARFTypeEncoding`
17061706
Flags: DIFlags, // (optional; default is `DIFlags::FlagZero`)
17071707
) -> &'ll Metadata;
1708+
1709+
pub(crate) fn LLVMDIBuilderCreatePointerType<'ll>(
1710+
Builder: &DIBuilder<'ll>,
1711+
PointeeTy: &'ll Metadata,
1712+
SizeInBits: u64,
1713+
AlignInBits: u32,
1714+
AddressSpace: c_uint,
1715+
Name: *const c_uchar,
1716+
NameLen: size_t,
1717+
) -> &'ll Metadata;
17081718
}
17091719

17101720
#[link(name = "llvm-wrapper", kind = "static")]
@@ -2047,16 +2057,6 @@ unsafe extern "C" {
20472057
Scope: Option<&'a DIScope>,
20482058
) -> &'a DIDerivedType;
20492059

2050-
pub fn LLVMRustDIBuilderCreatePointerType<'a>(
2051-
Builder: &DIBuilder<'a>,
2052-
PointeeTy: &'a DIType,
2053-
SizeInBits: u64,
2054-
AlignInBits: u32,
2055-
AddressSpace: c_uint,
2056-
Name: *const c_char,
2057-
NameLen: size_t,
2058-
) -> &'a DIDerivedType;
2059-
20602060
pub fn LLVMRustDIBuilderCreateStructType<'a>(
20612061
Builder: &DIBuilder<'a>,
20622062
Scope: Option<&'a DIDescriptor>,

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -990,15 +990,6 @@ LLVMRustDIBuilderCreateTypedef(LLVMRustDIBuilderRef Builder,
990990
LineNo, unwrapDIPtr<DIScope>(Scope)));
991991
}
992992

993-
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreatePointerType(
994-
LLVMRustDIBuilderRef Builder, LLVMMetadataRef PointeeTy,
995-
uint64_t SizeInBits, uint32_t AlignInBits, unsigned AddressSpace,
996-
const char *Name, size_t NameLen) {
997-
return wrap(Builder->createPointerType(unwrapDI<DIType>(PointeeTy),
998-
SizeInBits, AlignInBits, AddressSpace,
999-
StringRef(Name, NameLen)));
1000-
}
1001-
1002993
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateStructType(
1003994
LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
1004995
size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,

0 commit comments

Comments
 (0)