Skip to content

Commit 8dfd3a4

Browse files
committed
Remove LLVMRustDIBuilderInsertDeclareAtEnd return value
The return value changed from an Instruction to a DbgRecord in LLVM 19. As we don't actually use the result, drop the return value entirely to support both.
1 parent 776b0ad commit 8dfd3a4

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2057,7 +2057,7 @@ extern "C" {
20572057
AddrOpsCount: c_uint,
20582058
DL: &'a DILocation,
20592059
InsertAtEnd: &'a BasicBlock,
2060-
) -> &'a Value;
2060+
);
20612061

20622062
pub fn LLVMRustDIBuilderCreateEnumerator<'a>(
20632063
Builder: &DIBuilder<'a>,

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

+6-11
Original file line numberDiff line numberDiff line change
@@ -1137,20 +1137,15 @@ LLVMRustDIBuilderGetOrCreateArray(LLVMRustDIBuilderRef Builder,
11371137
Builder->getOrCreateArray(ArrayRef<Metadata *>(DataValue, Count)).get());
11381138
}
11391139

1140-
extern "C" LLVMValueRef LLVMRustDIBuilderInsertDeclareAtEnd(
1140+
extern "C" void LLVMRustDIBuilderInsertDeclareAtEnd(
11411141
LLVMRustDIBuilderRef Builder, LLVMValueRef V, LLVMMetadataRef VarInfo,
11421142
uint64_t *AddrOps, unsigned AddrOpsCount, LLVMMetadataRef DL,
11431143
LLVMBasicBlockRef InsertAtEnd) {
1144-
auto Result = Builder->insertDeclare(
1145-
unwrap(V), unwrap<DILocalVariable>(VarInfo),
1146-
Builder->createExpression(
1147-
llvm::ArrayRef<uint64_t>(AddrOps, AddrOpsCount)),
1148-
DebugLoc(cast<MDNode>(unwrap(DL))), unwrap(InsertAtEnd));
1149-
#if LLVM_VERSION_GE(19, 0)
1150-
return wrap(Result.get<llvm::Instruction *>());
1151-
#else
1152-
return wrap(Result);
1153-
#endif
1144+
Builder->insertDeclare(unwrap(V), unwrap<DILocalVariable>(VarInfo),
1145+
Builder->createExpression(
1146+
llvm::ArrayRef<uint64_t>(AddrOps, AddrOpsCount)),
1147+
DebugLoc(cast<MDNode>(unwrap(DL))),
1148+
unwrap(InsertAtEnd));
11541149
}
11551150

11561151
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateEnumerator(

0 commit comments

Comments
 (0)