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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76755 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index 174e183..705939b 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -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);