From: Benjamin Kramer Date: Sat, 1 Apr 2017 17:59:01 +0000 (+0000) Subject: [ObjC++] Use the correct EH personality in GNU mode X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5285209f96486181a4179963f5f3c6ba2a375607;p=clang [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 --- diff --git a/lib/CodeGen/CGException.cpp b/lib/CodeGen/CGException.cpp index 228efec51b..ca1535182e 100644 --- a/lib/CodeGen/CGException.cpp +++ b/lib/CodeGen/CGException.cpp @@ -180,8 +180,8 @@ static const EHPersonality &getObjCXXPersonality(const llvm::Triple &T, // The GCC runtime's personality function inherently doesn't support // mixed EH. Use the C++ personality just to avoid returning null. case ObjCRuntime::GCC: - case ObjCRuntime::ObjFW: // XXX: this will change soon - return EHPersonality::GNU_ObjC; + case ObjCRuntime::ObjFW: + return getObjCPersonality(T, L); case ObjCRuntime::GNUstep: return EHPersonality::GNU_ObjCXX; } diff --git a/test/CodeGenObjCXX/objfw-exceptions.mm b/test/CodeGenObjCXX/objfw-exceptions.mm new file mode 100644 index 0000000000..2c3182f543 --- /dev/null +++ b/test/CodeGenObjCXX/objfw-exceptions.mm @@ -0,0 +1,17 @@ +// 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 +// 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 + +@interface OCType @end +void opaque(); + +// CHECK: define void @_Z3foov() +// CHECK-DWARF-SAME: personality i8* bitcast (i32 (...)* @__gnu_objc_personality_v0 to i8*) +// CHECK-SJLJ-SAME: personality i8* bitcast (i32 (...)* @__gnu_objc_personality_sj0 to i8*) +void foo() { +try { +// CHECK: invoke void @_Z6opaquev +opaque(); +} catch (OCType *T) { +// CHECK: landingpad { i8*, i32 } +} +}