Skip to content

Commit 8475980

Browse files
committed
use LLVMDIBuilderGetOrCreateTypeArray from c api. Arguments type changed
1 parent b167331 commit 8475980

File tree

3 files changed

+8
-16
lines changed

3 files changed

+8
-16
lines changed

compiler/rustc_codegen_llvm/src/debuginfo/utils.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Utility Functions.
22

3+
use libc::size_t;
34
use rustc_hir::def_id::DefId;
45
use rustc_middle::ty::layout::{HasTypingEnv, LayoutOf};
56
use rustc_middle::ty::{self, Ty};
@@ -28,7 +29,7 @@ pub(crate) fn create_DIArray<'ll>(
2829
builder: &DIBuilder<'ll>,
2930
arr: &[Option<&'ll DIDescriptor>],
3031
) -> &'ll DIArray {
31-
unsafe { llvm::LLVMRustDIBuilderGetOrCreateArray(builder, arr.as_ptr(), arr.len() as u32) }
32+
unsafe { llvm::LLVMDIBuilderGetOrCreateTypeArray(builder, arr.as_ptr(), arr.len() as size_t) }
3233
}
3334

3435
#[inline]

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1846,6 +1846,12 @@ unsafe extern "C" {
18461846
Name: *const c_char,
18471847
NameLen: size_t,
18481848
) -> &'ll DIDerivedType;
1849+
1850+
pub(crate) fn LLVMDIBuilderGetOrCreateTypeArray<'ll>(
1851+
Builder: &DIBuilder<'ll>,
1852+
Data: *const Option<&'ll DIDescriptor>, //FIXME: is it really const?
1853+
Length: size_t,
1854+
) -> &'ll DIArray;
18491855
}
18501856

18511857
#[link(name = "llvm-wrapper", kind = "static")]
@@ -2310,12 +2316,6 @@ unsafe extern "C" {
23102316
Count: i64,
23112317
) -> &'a DISubrange;
23122318

2313-
pub(crate) fn LLVMRustDIBuilderGetOrCreateArray<'a>(
2314-
Builder: &DIBuilder<'a>,
2315-
Ptr: *const Option<&'a DIDescriptor>,
2316-
Count: c_uint,
2317-
) -> &'a DIArray;
2318-
23192319
pub(crate) fn LLVMRustDIBuilderInsertDeclareAtEnd<'a>(
23202320
Builder: &DIBuilder<'a>,
23212321
Val: &'a Value,

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,15 +1204,6 @@ LLVMRustDIBuilderGetOrCreateSubrange(LLVMDIBuilderRef Builder, int64_t Lo,
12041204
return wrap(unwrap(Builder)->getOrCreateSubrange(Lo, Count));
12051205
}
12061206

1207-
extern "C" LLVMMetadataRef
1208-
LLVMRustDIBuilderGetOrCreateArray(LLVMDIBuilderRef Builder,
1209-
LLVMMetadataRef *Ptr, unsigned Count) {
1210-
Metadata **DataValue = unwrap(Ptr);
1211-
return wrap(unwrap(Builder)
1212-
->getOrCreateArray(ArrayRef<Metadata *>(DataValue, Count))
1213-
.get());
1214-
}
1215-
12161207
extern "C" void
12171208
LLVMRustDIBuilderInsertDeclareAtEnd(LLVMDIBuilderRef Builder, LLVMValueRef V,
12181209
LLVMMetadataRef VarInfo, uint64_t *AddrOps,

0 commit comments

Comments
 (0)