[cfe-commits] r76755 - in /cfe/trunk: lib/AST/ASTContext.cpp lib/CodeGen/Mangle.cpp test/CodeGenObjC/encode-test.m test/CodeGenObjC/overloadable.m

Steve Naroff snaroff at apple.com
Wed Jul 22 10:14:52 PDT 2009


Author: snaroff
Date: Wed Jul 22 12:14:51 2009
New Revision: 76755

URL: http://llvm.org/viewvc/llvm-project?rev=76755&view=rev
Log:
Fix a couple recent ABI regressions noticed during code review (fallout from the ObjC type system rewrite).

It's unfortunate that the mangling includes the low-level structs. Nevertheless, we need this for binary compatibility with GCC.

Modified:
    cfe/trunk/lib/AST/ASTContext.cpp
    cfe/trunk/lib/CodeGen/Mangle.cpp
    cfe/trunk/test/CodeGenObjC/encode-test.m
    cfe/trunk/test/CodeGenObjC/overloadable.m

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=76755&r1=76754&r2=76755&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Wed Jul 22 12:14:51 2009
@@ -2655,8 +2655,19 @@
         S += '*';
         return;
       }
+    } else if (const RecordType *RTy = PointeeTy->getAsRecordType()) {
+      // GCC binary compat: Need to convert "struct objc_class *" to "#".
+      if (RTy->getDecl()->getIdentifier() == &Idents.get("objc_class")) {
+        S += '#';
+        return;
+      }
+      // GCC binary compat: Need to convert "struct objc_object *" to "@".
+      if (RTy->getDecl()->getIdentifier() == &Idents.get("objc_object")) {
+        S += '@';
+        return;
+      }
+      // fall through...
     }
-    
     S += '^';
     getLegacyIntegralTypeEncoding(PointeeTy);
 

Modified: cfe/trunk/lib/CodeGen/Mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.cpp?rev=76755&r1=76754&r2=76755&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Wed Jul 22 12:14:51 2009
@@ -577,8 +577,8 @@
   case BuiltinType::UndeducedAuto:
     assert(0 && "Should not see undeduced auto here");
     break;
-  case BuiltinType::ObjCId: Out << "2id"; break;
-  case BuiltinType::ObjCClass: Out << "5Class"; break;
+  case BuiltinType::ObjCId: Out << "11objc_object"; break;
+  case BuiltinType::ObjCClass: Out << "10objc_class"; break;
   }
 }
 

Modified: cfe/trunk/test/CodeGenObjC/encode-test.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/encode-test.m?rev=76755&r1=76754&r2=76755&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenObjC/encode-test.m (original)
+++ cfe/trunk/test/CodeGenObjC/encode-test.m Wed Jul 22 12:14:51 2009
@@ -1,7 +1,7 @@
 // RUN: clang-cc -triple=i686-apple-darwin9 -fnext-runtime -emit-llvm -o %t %s &&
 // RUN: grep -e "\^{Innermost=CC}" %t | count 1 &&
-// RUN: grep -e "{Derived=^{objc_class}ib32b8b3b8sb16b8b8b2b8ccb6}" %t | count 1 &&
-// RUN: grep -e "{B1=^{objc_class}@c}" %t | count 1 &&
+// RUN: grep -e "{Derived=#ib32b8b3b8sb16b8b8b2b8ccb6}" %t | count 1 &&
+// RUN: grep -e "{B1=#@c}" %t | count 1 &&
 // RUN: grep -e "v12 at 0:4\[3\[4@]]8" %t | count 1 &&
 // RUN: grep -e "r\^{S=i}" %t | count 1 &&
 // RUN: grep -e "\^{Object=#}" %t | count 1

Modified: cfe/trunk/test/CodeGenObjC/overloadable.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/overloadable.m?rev=76755&r1=76754&r2=76755&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenObjC/overloadable.m (original)
+++ cfe/trunk/test/CodeGenObjC/overloadable.m Wed Jul 22 12:14:51 2009
@@ -3,7 +3,7 @@
 
 @class C;
 
-// RUN: grep _Z1fP2id %t | count 1 && 
+// RUN: grep _Z1fP11objc_object %t | count 1 && 
 void __attribute__((overloadable)) f(id c) { }
 
 // RUN: grep _Z1fP1C %t | count 1





More information about the cfe-commits mailing list