aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Chisnall <csdavec@swan.ac.uk>2011-03-16 18:56:44 +0000
committerDavid Chisnall <csdavec@swan.ac.uk>2011-03-16 18:56:44 +0000
commit04fa52db15354f38310d8e3eca65c49ab77cb969 (patch)
treee8d34cce7a6c34d03016c603db964e053863f1e1
parent98a4c87e737af741016ce4f86c16d439c3c5ffbb (diff)
downloadllvm-04fa52db15354f38310d8e3eca65c49ab77cb969.zip
llvm-04fa52db15354f38310d8e3eca65c49ab77cb969.tar.gz
llvm-04fa52db15354f38310d8e3eca65c49ab77cb969.tar.bz2
Merge EH fix from trunk (GNUstep ObjC runtime).
Approved by Doug Gregor. llvm-svn: 127745
-rw-r--r--clang/lib/CodeGen/CGObjCGNU.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp
index 5bd45a0..fa87311 100644
--- a/clang/lib/CodeGen/CGObjCGNU.cpp
+++ b/clang/lib/CodeGen/CGObjCGNU.cpp
@@ -1993,17 +1993,28 @@ void CGObjCGNU::EmitTryStmt(CodeGen::CodeGenFunction &CGF,
// @catch() and @catch(id) both catch any ObjC exception.
// Treat them as catch-alls.
- // FIXME: this is what this code was doing before, but should 'id'
// really be catching foreign exceptions?
- if (!CatchDecl
- || CatchDecl->getType()->isObjCIdType()
- || CatchDecl->getType()->isObjCQualifiedIdType()) {
-
+
+ if (!CatchDecl) {
Handler.TypeInfo = 0; // catch-all
-
// Don't consider any other catches.
break;
}
+ if (CatchDecl->getType()->isObjCIdType()
+ || CatchDecl->getType()->isObjCQualifiedIdType()) {
+ // With the old ABI, there was only one kind of catchall, which broke
+ // foreign exceptions. With the new ABI, we use __objc_id_typeinfo as
+ // a pointer indicating object catchalls, and NULL to indicate real
+ // catchalls
+ if (CGM.getLangOptions().ObjCNonFragileABI) {
+ Handler.TypeInfo = MakeConstantString("@id");
+ continue;
+ } else {
+ Handler.TypeInfo = 0; // catch-all
+ // Don't consider any other catches.
+ break;
+ }
+ }
// All other types should be Objective-C interface pointer types.
const ObjCObjectPointerType *OPT =