Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit 41585aa

Browse files
committed
Merge r242372 to 3.7 so that it goes out in 3.7.1
It restores the signature of LLVMBuildLandingPad in the C API back to what it was in 3.6 and earlier. The 3.7.0 release should have had this but it did not. git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_37@247191 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent dccade9 commit 41585aa

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

bindings/go/llvm/ir.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1728,7 +1728,7 @@ func (b Builder) CreatePtrDiff(lhs, rhs Value, name string) (v Value) {
17281728
func (b Builder) CreateLandingPad(t Type, personality Value, nclauses int, name string) (l Value) {
17291729
cname := C.CString(name)
17301730
defer C.free(unsafe.Pointer(cname))
1731-
l.C = C.LLVMBuildLandingPad(b.C, t.C, C.unsigned(nclauses), cname)
1731+
l.C = C.LLVMBuildLandingPad(b.C, t.C, nil, C.unsigned(nclauses), cname)
17321732
return l
17331733
}
17341734

bindings/ocaml/llvm/llvm_ocaml.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1745,7 +1745,7 @@ CAMLprim LLVMValueRef llvm_build_invoke_bc(value Args[], int NumArgs) {
17451745
CAMLprim LLVMValueRef llvm_build_landingpad(LLVMTypeRef Ty, LLVMValueRef PersFn,
17461746
value NumClauses, value Name,
17471747
value B) {
1748-
return LLVMBuildLandingPad(Builder_val(B), Ty, Int_val(NumClauses),
1748+
return LLVMBuildLandingPad(Builder_val(B), Ty, PersFn, Int_val(NumClauses),
17491749
String_val(Name));
17501750
}
17511751

include/llvm-c/Core.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2675,7 +2675,8 @@ LLVMValueRef LLVMBuildInvoke(LLVMBuilderRef, LLVMValueRef Fn,
26752675
LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
26762676
const char *Name);
26772677
LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty,
2678-
unsigned NumClauses, const char *Name);
2678+
LLVMValueRef PersFn, unsigned NumClauses,
2679+
const char *Name);
26792680
LLVMValueRef LLVMBuildResume(LLVMBuilderRef B, LLVMValueRef Exn);
26802681
LLVMValueRef LLVMBuildUnreachable(LLVMBuilderRef);
26812682

lib/IR/Core.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2257,7 +2257,14 @@ LLVMValueRef LLVMBuildInvoke(LLVMBuilderRef B, LLVMValueRef Fn,
22572257
}
22582258

22592259
LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty,
2260-
unsigned NumClauses, const char *Name) {
2260+
LLVMValueRef PersFn, unsigned NumClauses,
2261+
const char *Name) {
2262+
// The personality used to live on the landingpad instruction, but now it
2263+
// lives on the parent function. For compatibility, take the provided
2264+
// personality and put it on the parent function.
2265+
if (PersFn)
2266+
unwrap(B)->GetInsertBlock()->getParent()->setPersonalityFn(
2267+
cast<Function>(unwrap(PersFn)));
22612268
return wrap(unwrap(B)->CreateLandingPad(unwrap(Ty), NumClauses, Name));
22622269
}
22632270

0 commit comments

Comments
 (0)