summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2009-07-22 17:14:51 +0000
committerSteve Naroff <snaroff@apple.com>2009-07-22 17:14:51 +0000
commit3de6b707302be0a4e55a4503d7b1d71b0cc3f837 (patch)
treec5a600b54f4cb0bb8e9725e9d2fe747948abbaf5 /clang
parente23388b25c40012dc5df73c1cda223afa95fa9db (diff)
downloadbcm5719-llvm-3de6b707302be0a4e55a4503d7b1d71b0cc3f837.tar.gz
bcm5719-llvm-3de6b707302be0a4e55a4503d7b1d71b0cc3f837.zip
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. llvm-svn: 76755
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/AST/ASTContext.cpp13
-rw-r--r--clang/lib/CodeGen/Mangle.cpp4
-rw-r--r--clang/test/CodeGenObjC/encode-test.m4
-rw-r--r--clang/test/CodeGenObjC/overloadable.m2
4 files changed, 17 insertions, 6 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 174e183d530..705939be728 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -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);
diff --git a/clang/lib/CodeGen/Mangle.cpp b/clang/lib/CodeGen/Mangle.cpp
index 5340cd72628..9e389040b81 100644
--- a/clang/lib/CodeGen/Mangle.cpp
+++ b/clang/lib/CodeGen/Mangle.cpp
@@ -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;
}
}
diff --git a/clang/test/CodeGenObjC/encode-test.m b/clang/test/CodeGenObjC/encode-test.m
index 8d78639e964..ca54a51c3b1 100644
--- a/clang/test/CodeGenObjC/encode-test.m
+++ b/clang/test/CodeGenObjC/encode-test.m
@@ -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
diff --git a/clang/test/CodeGenObjC/overloadable.m b/clang/test/CodeGenObjC/overloadable.m
index fc5c2e40859..7e9cc3d3b36 100644
--- a/clang/test/CodeGenObjC/overloadable.m
+++ b/clang/test/CodeGenObjC/overloadable.m
@@ -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
OpenPOWER on IntegriCloud