From 3de6b707302be0a4e55a4503d7b1d71b0cc3f837 Mon Sep 17 00:00:00 2001 From: Steve Naroff Date: Wed, 22 Jul 2009 17:14:51 +0000 Subject: 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 --- clang/lib/AST/ASTContext.cpp | 13 ++++++++++++- clang/lib/CodeGen/Mangle.cpp | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'clang/lib') 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; } } -- cgit v1.2.3