Skip to content

Commit ae33a97

Browse files
committed
Set personality with LLVMSetPersonalityFn
1 parent a84d1b2 commit ae33a97

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

compiler/rustc_codegen_llvm/src/builder.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -937,8 +937,12 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
937937
pers_fn: &'ll Value,
938938
num_clauses: usize,
939939
) -> &'ll Value {
940+
// Use LLVMSetPersonalityFn to set the personality. It supports arbitrary Consts while,
941+
// LLVMBuildLandingPad requires the argument to be a Function (as of LLVM 12). The
942+
// personality lives on the parent function anyway.
943+
self.set_personality_fn(pers_fn);
940944
unsafe {
941-
llvm::LLVMBuildLandingPad(self.llbuilder, ty, pers_fn, num_clauses as c_uint, UNNAMED)
945+
llvm::LLVMBuildLandingPad(self.llbuilder, ty, None, num_clauses as c_uint, UNNAMED)
942946
}
943947
}
944948

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,7 @@ extern "C" {
11651165
pub fn LLVMBuildLandingPad(
11661166
B: &Builder<'a>,
11671167
Ty: &'a Type,
1168-
PersFn: &'a Value,
1168+
PersFn: Option<&'a Value>,
11691169
NumClauses: c_uint,
11701170
Name: *const c_char,
11711171
) -> &'a Value;

0 commit comments

Comments
 (0)