about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorKrasimir Georgiev <krasimir@google.com>2022-06-29 14:00:40 +0000
committerKrasimir Georgiev <krasimir@google.com>2022-06-30 12:47:34 +0000
commita3a88c73f104d11849a31ebbf1c4ff4b10fc1e8d (patch)
treea2e74a64054307b76825b37a7c373451136dd599 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parenta9eb9c52f3e8d8b6402e6acc69b9bcfc4f371d58 (diff)
downloadrust-a3a88c73f104d11849a31ebbf1c4ff4b10fc1e8d.tar.gz
rust-a3a88c73f104d11849a31ebbf1c4ff4b10fc1e8d.zip
llvm-wrapper: adapt for LLVMConstExtractValue removal
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
index a52d5340242..8c5b4e2dc96 100644
--- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
@@ -1865,3 +1865,11 @@ extern "C" void LLVMRustGetMangledName(LLVMValueRef V, RustStringRef Str) {
   GlobalValue *GV = unwrap<GlobalValue>(V);
   Mangler().getNameWithPrefix(OS, GV, true);
 }
+
+// LLVMGetAggregateElement was added in LLVM 15. For earlier LLVM versions just
+// use its implementation.
+#if LLVM_VERSION_LT(15, 0)
+extern "C" LLVMValueRef LLVMGetAggregateElement(LLVMValueRef C, unsigned Idx) {
+    return wrap(unwrap<Constant>(C)->getAggregateElement(Idx));
+}
+#endif