diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2008-12-20 19:17:01 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2008-12-20 19:17:01 +0000 |
commit | adcaf544a9d863a4afb29cc5420095320fccafd8 (patch) | |
tree | 342d92eab55e32bdcf5eada2d86af0f6044f66b3 | |
parent | e6d5a4a58346441c969d5fcc7aa053e029186f86 (diff) |
Strangely enough, name of ObjC class is not encoded into the
full encoding of the class which has an ivar of pointer to this
class. Its name is encoded in the type for the ivar in the
ivar-list metadata. This patch conforms to the above rule.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61282 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/ASTContext.cpp | 10 | ||||
-rw-r--r-- | test/CodeGenObjC/encode-test.m | 15 |
2 files changed, 20 insertions, 5 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index c50a021028..d03ed41a15 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -1795,10 +1795,12 @@ void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string& S, } else if (PointeeTy->isObjCInterfaceType()) { S += '@'; - ObjCInterfaceDecl *OI = PointeeTy->getAsObjCInterfaceType()->getDecl(); - S += '"'; - S += OI->getNameAsCString(); - S += '"'; + if (FD) { + ObjCInterfaceDecl *OI = PointeeTy->getAsObjCInterfaceType()->getDecl(); + S += '"'; + S += OI->getNameAsCString(); + S += '"'; + } return; } else if (isObjCClassType(PointeeTy)) { S += '#'; diff --git a/test/CodeGenObjC/encode-test.m b/test/CodeGenObjC/encode-test.m index 982faf03ba..109f0573e5 100644 --- a/test/CodeGenObjC/encode-test.m +++ b/test/CodeGenObjC/encode-test.m @@ -1,6 +1,7 @@ // RUN: clang -fnext-runtime -emit-llvm -o %t %s && // RUN: grep -e "\^{Innermost=CC}" %t | count 1 && -// RUN: grep -e "{Derived=#ib32b8b3b8sb16b8b8b2b8ccb6}" %t | count 1 +// RUN: grep -e "{Derived=#ib32b8b3b8sb16b8b8b2b8ccb6}" %t | count 1 && +// RUN: grep -e "{B1=#@c}" %t | count 1 @class Int1; @@ -48,8 +49,20 @@ struct Innermost { @implementation Derived @end +@interface B1 +{ + struct objc_class *isa; + Int1 *sBase; + char c; +} +@end + +@implementation B1 +@end + int main() { const char *en = @encode(Derived); + const char *eb = @encode(B1); } |