Skip to content

Commit 6da7e1a

Browse files
committed
use LLVMDIBuilderGetOrCreateSubrange
corrected longlong -> i64 type
1 parent 8475980 commit 6da7e1a

File tree

3 files changed

+10
-18
lines changed

3 files changed

+10
-18
lines changed

compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::path::{Path, PathBuf};
55
use std::sync::Arc;
66
use std::{iter, ptr};
77

8-
use libc::{c_longlong, c_uint};
8+
use libc::c_uint;
99
use rustc_abi::{Align, Size};
1010
use rustc_codegen_ssa::debuginfo::type_names::{VTableNameKind, cpp_like_debuginfo};
1111
use rustc_codegen_ssa::traits::*;
@@ -112,12 +112,10 @@ fn build_fixed_size_array_di_node<'ll, 'tcx>(
112112

113113
let (size, align) = cx.size_and_align_of(array_type);
114114

115-
let upper_bound = len
116-
.try_to_target_usize(cx.tcx)
117-
.expect("expected monomorphic const in codegen") as c_longlong;
115+
let count =
116+
len.try_to_target_usize(cx.tcx).expect("expected monomorphic const in codegen") as i64;
118117

119-
let subrange =
120-
unsafe { Some(llvm::LLVMRustDIBuilderGetOrCreateSubrange(DIB(cx), 0, upper_bound)) };
118+
let subrange = unsafe { Some(llvm::LLVMDIBuilderGetOrCreateSubrange(DIB(cx), 0, count)) };
121119

122120
let subscripts = create_DIArray(DIB(cx), &[subrange]);
123121
let di_node = unsafe {

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,6 +1852,12 @@ unsafe extern "C" {
18521852
Data: *const Option<&'ll DIDescriptor>, //FIXME: is it really const?
18531853
Length: size_t,
18541854
) -> &'ll DIArray;
1855+
1856+
pub(crate) fn LLVMDIBuilderGetOrCreateSubrange<'ll>(
1857+
Builder: &DIBuilder<'ll>,
1858+
Lo: i64,
1859+
Count: i64,
1860+
) -> &'ll DISubrange;
18551861
}
18561862

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

2313-
pub(crate) fn LLVMRustDIBuilderGetOrCreateSubrange<'a>(
2314-
Builder: &DIBuilder<'a>,
2315-
Lo: i64,
2316-
Count: i64,
2317-
) -> &'a DISubrange;
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 & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,12 +1198,6 @@ LLVMRustDIBuilderCreateArrayType(LLVMDIBuilderRef Builder, uint64_t Size,
11981198
DINodeArray(unwrapDI<MDTuple>(Subscripts))));
11991199
}
12001200

1201-
extern "C" LLVMMetadataRef
1202-
LLVMRustDIBuilderGetOrCreateSubrange(LLVMDIBuilderRef Builder, int64_t Lo,
1203-
int64_t Count) {
1204-
return wrap(unwrap(Builder)->getOrCreateSubrange(Lo, Count));
1205-
}
1206-
12071201
extern "C" void
12081202
LLVMRustDIBuilderInsertDeclareAtEnd(LLVMDIBuilderRef Builder, LLVMValueRef V,
12091203
LLVMMetadataRef VarInfo, uint64_t *AddrOps,

0 commit comments

Comments
 (0)