[cfe-commits] r44087 - in /cfe/trunk: AST/ASTContext.cpp test/Sema/metadata-test-2.m

Fariborz Jahanian fjahanian at apple.com
Tue Nov 13 15:21:38 PST 2007


Author: fjahanian
Date: Tue Nov 13 17:21:38 2007
New Revision: 44087

URL: http://llvm.org/viewvc/llvm-project?rev=44087&view=rev
Log:
Type encoding for structs.

Added:
    cfe/trunk/test/Sema/metadata-test-2.m
Modified:
    cfe/trunk/AST/ASTContext.cpp

Modified: cfe/trunk/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/ASTContext.cpp?rev=44087&r1=44086&r2=44087&view=diff

==============================================================================
--- cfe/trunk/AST/ASTContext.cpp (original)
+++ cfe/trunk/AST/ASTContext.cpp Tue Nov 13 17:21:38 2007
@@ -1050,8 +1050,18 @@
     S += ']';
   } else if (T->getAsFunctionType()) {
     S += '?';
+  } else if (const RecordType *RTy = T->getAsRecordType()) {
+    RecordDecl *RDecl= RTy->getDecl();
+    S += '{';
+    S += RDecl->getName();
+    S += '=';
+    for (int i = 0; i < RDecl->getNumMembers(); i++) {
+      FieldDecl *field = RDecl->getMember(i);
+      getObjcEncodingForType(field->getType(), S);
+    }
+    S += '}';
   } else
-    assert(0 && "@encode for type not implemented!");
+      assert(0 && "@encode for type not implemented!");
 }
 
 void ASTContext::getObjcEncodingForTypeQualifier(Decl::ObjcDeclQualifier QT, 

Added: cfe/trunk/test/Sema/metadata-test-2.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/metadata-test-2.m?rev=44087&view=auto

==============================================================================
--- cfe/trunk/test/Sema/metadata-test-2.m (added)
+++ cfe/trunk/test/Sema/metadata-test-2.m Tue Nov 13 17:21:38 2007
@@ -0,0 +1,15 @@
+// RUN: clang -rewrite-test %s
+
+typedef struct _NSPoint {
+    float x;
+    float y;
+} NSPoint;
+
+ at interface Intf
+- (void) MyMeth : (NSPoint) Arg1;
+ at end
+
+ at implementation Intf
+- (void) MyMeth : (NSPoint) Arg1{}
+ at end
+





More information about the cfe-commits mailing list