[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.

llvm-svn: 299306
This commit is contained in:
Benjamin Kramer 2017-04-01 17:59:01 +00:00
parent 5e94bb00b3
commit 9851cb76e2
2 changed files with 19 additions and 2 deletions

View File

@ -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;
}

View File

@ -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 }
}
}