about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-06-30 08:56:56 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-07-16 20:25:51 -0700
commit7f0e733f1d8e597faee4bff0fc04838867725fad (patch)
tree4d0fbbc0f4de4c599a865b22ba6a00bcc736798e /src/rustllvm/RustWrapper.cpp
parentc55d3f1ba1e78466d2f5703a9e291f4849ddcc94 (diff)
downloadrust-7f0e733f1d8e597faee4bff0fc04838867725fad.tar.gz
rust-7f0e733f1d8e597faee4bff0fc04838867725fad.zip
rustc_trans: Update LLVMBuildLandingPad signature
The C API of this function changed so it no longer takes a personality function.
A shim was introduced to call the right LLVM function (depending on which
version we're compiled against) to set the personality function on the outer
function.

The compiler only ever sets one personality function for all generated
functions, so this should be equivalent.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
-rw-r--r--src/rustllvm/RustWrapper.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp
index 6861ad43a3c..163e95b890f 100644
--- a/src/rustllvm/RustWrapper.cpp
+++ b/src/rustllvm/RustWrapper.cpp
@@ -942,3 +942,18 @@ extern "C" void LLVMWriteSMDiagnosticToString(LLVMSMDiagnosticRef d, RustStringR
     raw_rust_string_ostream os(str);
     unwrap(d)->print("", os);
 }
+
+extern "C" LLVMValueRef
+LLVMRustBuildLandingPad(LLVMBuilderRef Builder,
+                        LLVMTypeRef Ty,
+                        LLVMValueRef PersFn,
+                        unsigned NumClauses,
+                        const char* Name,
+                        LLVMValueRef F) {
+#if LLVM_VERSION_MINOR >= 7
+    unwrap<Function>(F)->setPersonalityFn(unwrap<Constant>(PersFn));
+    return LLVMBuildLandingPad(Builder, Ty, NumClauses, Name);
+#else
+    return LLVMBuildLandingPad(Builder, Ty, PersFn, NumClauses, Name);
+#endif
+}