r299306 - [ObjC++] Use the correct EH personality in GNU mode
Benjamin Kramer via cfe-commits
cfe-commits at lists.llvm.org
Sat Apr 1 10:59:01 PDT 2017
Author: d0k
Date: Sat Apr 1 12:59:01 2017
New Revision: 299306
URL: http://llvm.org/viewvc/llvm-project?rev=299306&view=rev
Log:
[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.
Added:
cfe/trunk/test/CodeGenObjCXX/objfw-exceptions.mm
Modified:
cfe/trunk/lib/CodeGen/CGException.cpp
Modified: cfe/trunk/lib/CodeGen/CGException.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=299306&r1=299305&r2=299306&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGException.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGException.cpp Sat Apr 1 12:59:01 2017
@@ -180,8 +180,8 @@ static const EHPersonality &getObjCXXPer
// 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;
}
Added: cfe/trunk/test/CodeGenObjCXX/objfw-exceptions.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/objfw-exceptions.mm?rev=299306&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjCXX/objfw-exceptions.mm (added)
+++ cfe/trunk/test/CodeGenObjCXX/objfw-exceptions.mm Sat Apr 1 12:59:01 2017
@@ -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
+
+ at 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 }
+}
+}
More information about the cfe-commits
mailing list