diff options
| author | Benjamin Kramer <benny.kra@googlemail.com> | 2017-01-08 22:58:07 +0000 |
|---|---|---|
| committer | Benjamin Kramer <benny.kra@googlemail.com> | 2017-01-08 22:58:07 +0000 |
| commit | 796c1d9b5496b9c4337afca894d799229d036d2f (patch) | |
| tree | e2fb71cf9dc5d39c0ee3c69d0b6e9df0b9f959c4 | |
| parent | 32b43764025e5f41d9ec9aff382810cc417d9d58 (diff) | |
| download | bcm5719-llvm-796c1d9b5496b9c4337afca894d799229d036d2f.tar.gz bcm5719-llvm-796c1d9b5496b9c4337afca894d799229d036d2f.zip | |
Use the correct ObjC EH personality
This fixes ObjC exceptions on Win64 (which uses SEH), among others.
Patch by Jonathan Schleifer!
llvm-svn: 291408
| -rw-r--r-- | clang/lib/CodeGen/CGCleanup.h | 2 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGException.cpp | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGCleanup.h b/clang/lib/CodeGen/CGCleanup.h index 2166490ec1f..105c5629d50 100644 --- a/clang/lib/CodeGen/CGCleanup.h +++ b/clang/lib/CodeGen/CGCleanup.h @@ -616,6 +616,8 @@ struct EHPersonality { static const EHPersonality GNU_C_SJLJ; static const EHPersonality GNU_C_SEH; static const EHPersonality GNU_ObjC; + static const EHPersonality GNU_ObjC_SJLJ; + static const EHPersonality GNU_ObjC_SEH; static const EHPersonality GNUstep_ObjC; static const EHPersonality GNU_ObjCXX; static const EHPersonality NeXT_ObjC; diff --git a/clang/lib/CodeGen/CGException.cpp b/clang/lib/CodeGen/CGException.cpp index 7b7880e07a9..f908bf2b3b0 100644 --- a/clang/lib/CodeGen/CGException.cpp +++ b/clang/lib/CodeGen/CGException.cpp @@ -97,6 +97,10 @@ EHPersonality::GNU_CPlusPlus_SEH = { "__gxx_personality_seh0", nullptr }; const EHPersonality EHPersonality::GNU_ObjC = {"__gnu_objc_personality_v0", "objc_exception_throw"}; const EHPersonality +EHPersonality::GNU_ObjC_SJLJ = {"__gnu_objc_personality_sj0", "objc_exception_throw"}; +const EHPersonality +EHPersonality::GNU_ObjC_SEH = {"__gnu_objc_personality_seh0", "objc_exception_throw"}; +const EHPersonality EHPersonality::GNU_ObjCXX = { "__gnustep_objcxx_personality_v0", nullptr }; const EHPersonality EHPersonality::GNUstep_ObjC = { "__gnustep_objc_personality_v0", nullptr }; @@ -137,6 +141,10 @@ static const EHPersonality &getObjCPersonality(const llvm::Triple &T, // fallthrough case ObjCRuntime::GCC: case ObjCRuntime::ObjFW: + if (L.SjLjExceptions) + return EHPersonality::GNU_ObjC_SJLJ; + else if (useLibGCCSEHPersonality(T)) + return EHPersonality::GNU_ObjC_SEH; return EHPersonality::GNU_ObjC; } llvm_unreachable("bad runtime kind"); |

