From 0a2ddcd46b53cf1c1c0944fb69928af99fa05561 Mon Sep 17 00:00:00 2001 From: Krasimir Georgiev Date: Tue, 12 Mar 2024 12:39:25 +0000 Subject: [PATCH] llvm-wrapper: adapt for LLVM API changes Adapts rust for https://github.com/llvm/llvm-project/commit/9997e0397156ff7e01aecbd17bdeb7bfe5fb15b0. --- compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index d76dea6f86cca..1632b9e124905 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -1112,11 +1112,16 @@ extern "C" LLVMValueRef LLVMRustDIBuilderInsertDeclareAtEnd( LLVMRustDIBuilderRef Builder, LLVMValueRef V, LLVMMetadataRef VarInfo, uint64_t *AddrOps, unsigned AddrOpsCount, LLVMMetadataRef DL, LLVMBasicBlockRef InsertAtEnd) { - return wrap(Builder->insertDeclare( + auto Result = Builder->insertDeclare( unwrap(V), unwrap(VarInfo), Builder->createExpression(llvm::ArrayRef(AddrOps, AddrOpsCount)), DebugLoc(cast(unwrap(DL))), - unwrap(InsertAtEnd))); + unwrap(InsertAtEnd)); +#if LLVM_VERSION_GE(19, 0) + return wrap(Result.get()); +#else + return wrap(Result); +#endif } extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateEnumerator(