[cfe-commits] r61282 - in /cfe/trunk: lib/AST/ASTContext.cpp test/CodeGenObjC/encode-test.m
Fariborz Jahanian
fjahanian at apple.com
Sat Dec 20 11:17:03 PST 2008
Author: fjahanian
Date: Sat Dec 20 13:17:01 2008
New Revision: 61282
URL: http://llvm.org/viewvc/llvm-project?rev=61282&view=rev
Log:
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.
Modified:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/test/CodeGenObjC/encode-test.m
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=61282&r1=61281&r2=61282&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Sat Dec 20 13:17:01 2008
@@ -1795,10 +1795,12 @@
}
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 += '#';
Modified: cfe/trunk/test/CodeGenObjC/encode-test.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/encode-test.m?rev=61282&r1=61281&r2=61282&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/encode-test.m (original)
+++ cfe/trunk/test/CodeGenObjC/encode-test.m Sat Dec 20 13:17:01 2008
@@ -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 @@
@implementation Derived
@end
+ at interface B1
+{
+ struct objc_class *isa;
+ Int1 *sBase;
+ char c;
+}
+ at end
+
+ at implementation B1
+ at end
+
int main()
{
const char *en = @encode(Derived);
+ const char *eb = @encode(B1);
}
More information about the cfe-commits
mailing list