[cfe-commits] r61387 - in /cfe/trunk: lib/AST/ASTContext.cpp test/CodeGenObjC/encode-test.m

Fariborz Jahanian fjahanian at apple.com
Tue Dec 23 13:30:16 PST 2008


Author: fjahanian
Date: Tue Dec 23 15:30:15 2008
New Revision: 61387

URL: http://llvm.org/viewvc/llvm-project?rev=61387&view=rev
Log:
Last patch, for now, to privde ObjC's encoding of types.
We now pass all gcc's encoding compatibility tests.


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=61387&r1=61386&r2=61387&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Tue Dec 23 15:30:15 2008
@@ -1859,6 +1859,16 @@
       return;
     }
     else if (PointeeTy->isObjCInterfaceType()) {
+      if (dyn_cast<TypedefType>(PointeeTy.getTypePtr())) {
+        // Another historical/compatibility reason.
+        // We encode the underlying type which comes out as 
+        // {...};
+        S += '^';
+        getObjCEncodingForTypeImpl(PointeeTy, S, 
+                                   false, ExpandPointedToStructures, 
+                                   NULL);
+        return;
+      }
       S += '@';
       if (FD) {
         ObjCInterfaceDecl *OI = PointeeTy->getAsObjCInterfaceType()->getDecl();

Modified: cfe/trunk/test/CodeGenObjC/encode-test.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/encode-test.m?rev=61387&r1=61386&r2=61387&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenObjC/encode-test.m (original)
+++ cfe/trunk/test/CodeGenObjC/encode-test.m Tue Dec 23 15:30:15 2008
@@ -3,7 +3,8 @@
 // RUN: grep -e "{Derived=#ib32b8b3b8sb16b8b8b2b8ccb6}" %t | count 1 &&
 // RUN: grep -e "{B1=#@c}" %t | count 1 &&
 // RUN: grep -e "v12 at 0:4\[3\[4{Test=i}]]8" %t | count 1 &&
-// RUN: grep -e "r^{S=i}" %t | count 1
+// RUN: grep -e "r^{S=i}" %t | count 1 &&
+// RUN: grep -e "\^{Object=#}" %t | count 1
 
 @class Int1;
 
@@ -75,11 +76,19 @@
 
 struct S { int iS; };
 
+ at interface Object
+{
+ Class isa;
+}
+ at end
+typedef Object MyObj;
+
 int main()
 {
 	const char *en = @encode(Derived);
 	const char *eb = @encode(B1);
         const char *es = @encode(const struct S *);
         const char *ec = @encode(const struct S);
+        const char *ee = @encode(MyObj *const);
 }
 





More information about the cfe-commits mailing list