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.
This commit is contained in:
Alex Crichton 2015-06-30 08:56:56 -07:00
parent c55d3f1ba1
commit 7f0e733f1d
4 changed files with 28 additions and 10 deletions

View file

@ -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
}