Skip to content

Commit 4ce56b4

Browse files
committed
RustWrapper: adapt for an LLVM API change
No functional changes intended. The LLVM commit llvm/llvm-project@ec501f1 removed the signed version of `createExpression`. This adapts the Rust LLVM wrappers accordingly.
1 parent b5da808 commit 4ce56b4

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

Diff for: compiler/rustc_codegen_llvm/src/debuginfo/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -160,17 +160,17 @@ impl<'ll> DebugInfoBuilderMethods for Builder<'_, 'll, '_> {
160160
// the values should match the ones in the DWARF standard anyway.
161161
let op_deref = || unsafe { llvm::LLVMRustDIBuilderCreateOpDeref() };
162162
let op_plus_uconst = || unsafe { llvm::LLVMRustDIBuilderCreateOpPlusUconst() };
163-
let mut addr_ops = SmallVec::<[_; 8]>::new();
163+
let mut addr_ops = SmallVec::<[u64; 8]>::new();
164164

165165
if direct_offset.bytes() > 0 {
166166
addr_ops.push(op_plus_uconst());
167-
addr_ops.push(direct_offset.bytes() as i64);
167+
addr_ops.push(direct_offset.bytes() as u64);
168168
}
169169
for &offset in indirect_offsets {
170170
addr_ops.push(op_deref());
171171
if offset.bytes() > 0 {
172172
addr_ops.push(op_plus_uconst());
173-
addr_ops.push(offset.bytes() as i64);
173+
addr_ops.push(offset.bytes() as u64);
174174
}
175175
}
176176

Diff for: compiler/rustc_codegen_llvm/src/llvm/ffi.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2108,7 +2108,7 @@ extern "C" {
21082108
Builder: &DIBuilder<'a>,
21092109
Val: &'a Value,
21102110
VarInfo: &'a DIVariable,
2111-
AddrOps: *const i64,
2111+
AddrOps: *const u64,
21122112
AddrOpsCount: c_uint,
21132113
DL: &'a DILocation,
21142114
InsertAtEnd: &'a BasicBlock,
@@ -2199,8 +2199,8 @@ extern "C" {
21992199
Scope: &'a DIScope,
22002200
InlinedAt: Option<&'a DILocation>,
22012201
) -> &'a DILocation;
2202-
pub fn LLVMRustDIBuilderCreateOpDeref() -> i64;
2203-
pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> i64;
2202+
pub fn LLVMRustDIBuilderCreateOpDeref() -> u64;
2203+
pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> u64;
22042204

22052205
#[allow(improper_ctypes)]
22062206
pub fn LLVMRustWriteTypeToString(Type: &Type, s: &RustString);

Diff for: compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -979,11 +979,11 @@ LLVMRustDIBuilderGetOrCreateArray(LLVMRustDIBuilderRef Builder,
979979

980980
extern "C" LLVMValueRef LLVMRustDIBuilderInsertDeclareAtEnd(
981981
LLVMRustDIBuilderRef Builder, LLVMValueRef V, LLVMMetadataRef VarInfo,
982-
int64_t *AddrOps, unsigned AddrOpsCount, LLVMMetadataRef DL,
982+
uint64_t *AddrOps, unsigned AddrOpsCount, LLVMMetadataRef DL,
983983
LLVMBasicBlockRef InsertAtEnd) {
984984
return wrap(Builder->insertDeclare(
985985
unwrap(V), unwrap<DILocalVariable>(VarInfo),
986-
Builder->createExpression(llvm::ArrayRef<int64_t>(AddrOps, AddrOpsCount)),
986+
Builder->createExpression(llvm::ArrayRef<uint64_t>(AddrOps, AddrOpsCount)),
987987
DebugLoc(cast<MDNode>(unwrap(DL))),
988988
unwrap(InsertAtEnd)));
989989
}
@@ -1057,11 +1057,11 @@ LLVMRustDIBuilderCreateDebugLocation(unsigned Line, unsigned Column,
10571057
return wrap(Loc);
10581058
}
10591059

1060-
extern "C" int64_t LLVMRustDIBuilderCreateOpDeref() {
1060+
extern "C" uint64_t LLVMRustDIBuilderCreateOpDeref() {
10611061
return dwarf::DW_OP_deref;
10621062
}
10631063

1064-
extern "C" int64_t LLVMRustDIBuilderCreateOpPlusUconst() {
1064+
extern "C" uint64_t LLVMRustDIBuilderCreateOpPlusUconst() {
10651065
return dwarf::DW_OP_plus_uconst;
10661066
}
10671067

0 commit comments

Comments
 (0)