[llvm-branch-commits] [cfe-branch] r127745 - /cfe/branches/release_29/lib/CodeGen/CGObjCGNU.cpp

David Chisnall csdavec at swan.ac.uk
Wed Mar 16 11:56:44 PDT 2011


Author: theraven
Date: Wed Mar 16 13:56:44 2011
New Revision: 127745

URL: http://llvm.org/viewvc/llvm-project?rev=127745&view=rev
Log:
Merge EH fix from trunk (GNUstep ObjC runtime).

Approved by Doug Gregor.


Modified:
    cfe/branches/release_29/lib/CodeGen/CGObjCGNU.cpp

Modified: cfe/branches/release_29/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_29/lib/CodeGen/CGObjCGNU.cpp?rev=127745&r1=127744&r2=127745&view=diff
==============================================================================
--- cfe/branches/release_29/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/branches/release_29/lib/CodeGen/CGObjCGNU.cpp Wed Mar 16 13:56:44 2011
@@ -1993,17 +1993,28 @@
 
       // @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 =





More information about the llvm-branch-commits mailing list