[cfe-commits] r127736 - /cfe/trunk/lib/CodeGen/CGObjCGNU.cpp

David Chisnall csdavec at swan.ac.uk
Wed Mar 16 08:44:28 PDT 2011


Author: theraven
Date: Wed Mar 16 10:44:28 2011
New Revision: 127736

URL: http://llvm.org/viewvc/llvm-project?rev=127736&view=rev
Log:
Fix foreign exception handling (GNU runtime).


Modified:
    cfe/trunk/lib/CodeGen/CGObjCGNU.cpp

Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=127736&r1=127735&r2=127736&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Wed Mar 16 10:44:28 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 cfe-commits mailing list