]> granicus.if.org Git - clang/commitdiff
Fix a couple recent ABI regressions noticed during code review (fallout from the...
authorSteve Naroff <snaroff@apple.com>
Wed, 22 Jul 2009 17:14:51 +0000 (17:14 +0000)
committerSteve Naroff <snaroff@apple.com>
Wed, 22 Jul 2009 17:14:51 +0000 (17:14 +0000)
It's unfortunate that the mangling includes the low-level structs. Nevertheless, we need this for binary compatibility with GCC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76755 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTContext.cpp
lib/CodeGen/Mangle.cpp
test/CodeGenObjC/encode-test.m
test/CodeGenObjC/overloadable.m

index 174e183d530efb7ef0bc03aafc9feae1d864d739..705939be728203c4c7185662b07fa0a7a4060768 100644 (file)
@@ -2655,8 +2655,19 @@ void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string& S,
         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);
 
index 5340cd72628bd8eba9613a3edecde2ec63e92e98..9e389040b8185955c1cac2e360304f7958f4ecbc 100644 (file)
@@ -577,8 +577,8 @@ void CXXNameMangler::mangleType(const BuiltinType *T) {
   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;
   }
 }
 
index 8d78639e96481b209cfcc4377a7c56e981ba08a0..ca54a51c3b1ce251ecd9edf7a60e119634565af8 100644 (file)
@@ -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@0:4\[3\[4@]]8" %t | count 1 &&
 // RUN: grep -e "r\^{S=i}" %t | count 1 &&
 // RUN: grep -e "\^{Object=#}" %t | count 1
index fc5c2e40859e4d2e940810896df2544f76d65b18..7e9cc3d3b36da2065a13b43c036c98864f1d50a8 100644 (file)
@@ -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