summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDavid Chisnall <csdavec@swan.ac.uk>2011-03-16 15:44:28 +0000
committerDavid Chisnall <csdavec@swan.ac.uk>2011-03-16 15:44:28 +0000
commit803adc1bcf05e08877e64cb13d16ed00203a436d (patch)
treea08d491341a72817cc474dd20c46452c978a010e /clang/lib
parent22f8cd71178069508df3d6ff41c64558d610847d (diff)
downloadbcm5719-llvm-803adc1bcf05e08877e64cb13d16ed00203a436d.tar.gz
bcm5719-llvm-803adc1bcf05e08877e64cb13d16ed00203a436d.zip
Fix foreign exception handling (GNU runtime).
llvm-svn: 127736
Diffstat (limited to 'clang/lib')
-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 5bd45a01c4b..fa873116623 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 =
OpenPOWER on IntegriCloud