diff options
author | David Chisnall <csdavec@swan.ac.uk> | 2011-03-16 15:44:28 +0000 |
---|---|---|
committer | David Chisnall <csdavec@swan.ac.uk> | 2011-03-16 15:44:28 +0000 |
commit | 4d000b322fb1e7ed7fa2de5ab4bfb473bad2edae (patch) | |
tree | 2a43cf3ee6d4a6aa0984b5ac6e178e01d38d5edc /lib/CodeGen/CGObjCGNU.cpp | |
parent | 24f4674e697fb53587f0e8485e9c6592f7021ef2 (diff) |
Fix foreign exception handling (GNU runtime).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127736 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjCGNU.cpp')
-rw-r--r-- | lib/CodeGen/CGObjCGNU.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp index 5bd45a01c4..fa87311662 100644 --- a/lib/CodeGen/CGObjCGNU.cpp +++ b/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 = |