Skip to content

Commit 5285209

Browse files
committed
[ObjC++] Use the correct EH personality in GNU mode
Previously, it would just always use the ObjC DWARF personality, even with SjLj or SEH exceptions. Patch by Jonathan Schleifer, test case by me. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299306 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 256dc09 commit 5285209

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

lib/CodeGen/CGException.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ static const EHPersonality &getObjCXXPersonality(const llvm::Triple &T,
180180
// The GCC runtime's personality function inherently doesn't support
181181
// mixed EH. Use the C++ personality just to avoid returning null.
182182
case ObjCRuntime::GCC:
183-
case ObjCRuntime::ObjFW: // XXX: this will change soon
184-
return EHPersonality::GNU_ObjC;
183+
case ObjCRuntime::ObjFW:
184+
return getObjCPersonality(T, L);
185185
case ObjCRuntime::GNUstep:
186186
return EHPersonality::GNU_ObjCXX;
187187
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -fexceptions -fobjc-exceptions -fobjc-runtime=objfw -fcxx-exceptions -o - %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-DWARF
2+
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -fexceptions -fobjc-exceptions -fobjc-runtime=objfw -fcxx-exceptions -fsjlj-exceptions -o - %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-SJLJ
3+
4+
@interface OCType @end
5+
void opaque();
6+
7+
// CHECK: define void @_Z3foov()
8+
// CHECK-DWARF-SAME: personality i8* bitcast (i32 (...)* @__gnu_objc_personality_v0 to i8*)
9+
// CHECK-SJLJ-SAME: personality i8* bitcast (i32 (...)* @__gnu_objc_personality_sj0 to i8*)
10+
void foo() {
11+
try {
12+
// CHECK: invoke void @_Z6opaquev
13+
opaque();
14+
} catch (OCType *T) {
15+
// CHECK: landingpad { i8*, i32 }
16+
}
17+
}

0 commit comments

Comments
 (0)