[cfe-commits] r43504 - in /cfe/trunk: AST/ASTContext.cpp Sema/SemaDecl.cpp clang.xcodeproj/project.pbxproj test/Sema/method-encoding-1.m

Fariborz Jahanian fjahanian at apple.com
Tue Oct 30 10:06:23 PDT 2007


Author: fjahanian
Date: Tue Oct 30 12:06:23 2007
New Revision: 43504

URL: http://llvm.org/viewvc/llvm-project?rev=43504&view=rev
Log:
Added type encoding for 'id' type.

Added:
    cfe/trunk/test/Sema/method-encoding-1.m
Modified:
    cfe/trunk/AST/ASTContext.cpp
    cfe/trunk/Sema/SemaDecl.cpp
    cfe/trunk/clang.xcodeproj/project.pbxproj

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

==============================================================================
--- cfe/trunk/AST/ASTContext.cpp (original)
+++ cfe/trunk/AST/ASTContext.cpp Tue Oct 30 12:06:23 2007
@@ -1010,6 +1010,10 @@
     S += encoding;
   } else if (const PointerType *PT = T->getAsPointerType()) {
     QualType PointeeTy = PT->getPointeeType();
+    if (isObjcIdType(PointeeTy)) {
+      S += '@';
+      return;
+    }
     
     if (PointeeTy->isCharType()) {
       // char pointer types should be encoded as '*' unless it is a

Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=43504&r1=43503&r2=43504&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Tue Oct 30 12:06:23 2007
@@ -1963,6 +1963,14 @@
     TypeTy **ArgTypes, IdentifierInfo **ArgNames,
     AttributeList *AttrList, tok::ObjCKeywordKind MethodDeclKind) {
   llvm::SmallVector<ParmVarDecl*, 16> Params;
+  
+  // We cannot build type 'id' laziliy. It is needed when checking if a 
+  // type is an 'id' (via call to isObjcIdType) even if there is no
+  // need for the dafult 'id' type.
+  // FIXME: Depending on the need to compare to 'id', this may have to go
+  // somewhere else. At this time, this is a good enough place to do type
+  // encoding of methods and ivars for the rewrite client.
+  GetObjcIdType(MethodLoc);
 
   for (unsigned i = 0; i < Sel.getNumArgs(); i++) {
     // FIXME: arg->AttrList must be stored too!

Modified: cfe/trunk/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=43504&r1=43503&r2=43504&view=diff

==============================================================================
--- cfe/trunk/clang.xcodeproj/project.pbxproj (original)
+++ cfe/trunk/clang.xcodeproj/project.pbxproj Tue Oct 30 12:06:23 2007
@@ -756,6 +756,7 @@
 		08FB7793FE84155DC02AAC07 /* Project object */ = {
 			isa = PBXProject;
 			buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */;
+			compatibilityVersion = "Xcode 2.4";
 			hasScannedForEncodings = 1;
 			mainGroup = 08FB7794FE84155DC02AAC07 /* clang */;
 			projectDirPath = "";

Added: cfe/trunk/test/Sema/method-encoding-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/method-encoding-1.m?rev=43504&view=auto

==============================================================================
--- cfe/trunk/test/Sema/method-encoding-1.m (added)
+++ cfe/trunk/test/Sema/method-encoding-1.m Tue Oct 30 12:06:23 2007
@@ -0,0 +1,18 @@
+// RUN: clang -rewrite-test -verify %s
+
+ at protocol P1
+- (void) MyProtoMeth : (int **) arg1 : (void*) arg2;
++ (void) MyProtoMeth : (int **) arg1 : (void*) arg2;
+ at end
+
+ at interface Intf <P1>
+- (char *) MyMeth : (double) arg1 : (char *[12]) arg2;
+- (id) address:(void *)location with:(unsigned **)arg2;
+ at end
+
+ at implementation Intf
+- (char *) MyMeth : (double) arg1 : (char *[12]) arg2{}
+- (void) MyProtoMeth : (int **) arg1 : (void*) arg2 {}
++ (void) MyProtoMeth : (int **) arg1 : (void*) arg2 {}
+- (id) address:(void *)location with:(unsigned **)arg2{}
+ at end





More information about the cfe-commits mailing list