[cfe-commits] r139473 - in /cfe/trunk: lib/Rewrite/RewriteObjC.cpp test/Rewriter/instancetype-test.mm

Fariborz Jahanian fjahanian at apple.com
Sat Sep 10 10:01:56 PDT 2011


Author: fjahanian
Date: Sat Sep 10 12:01:56 2011
New Revision: 139473

URL: http://llvm.org/viewvc/llvm-project?rev=139473&view=rev
Log:
objc rewriter - more fixes to support compiling the rewritten
test case having instancetype. Fix in rewriter is unrelated to
using of instancetype. Test case uses other feature not yet
supported in the rewriter. There is more work to do, but this
is an ongoing task and not urgent at this time.

Modified:
    cfe/trunk/lib/Rewrite/RewriteObjC.cpp
    cfe/trunk/test/Rewriter/instancetype-test.mm

Modified: cfe/trunk/lib/Rewrite/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/RewriteObjC.cpp?rev=139473&r1=139472&r2=139473&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Rewrite/RewriteObjC.cpp Sat Sep 10 12:01:56 2011
@@ -420,8 +420,14 @@
       else if (T->isObjCQualifiedClassType())
         T = Context->getObjCClassType();
       else if (T->isObjCObjectPointerType() &&
-               T->getPointeeType()->isObjCQualifiedInterfaceType())
-        T = Context->getObjCIdType();
+               T->getPointeeType()->isObjCQualifiedInterfaceType()) {
+        if (const ObjCObjectPointerType * OBJPT =
+              T->getAsObjCInterfacePointerType()) {
+          const ObjCInterfaceType *IFaceT = OBJPT->getInterfaceType();
+          T = QualType(IFaceT, 0);
+          T = Context->getPointerType(T);
+        }
+     }
     }
     
     // FIXME: This predicate seems like it would be useful to add to ASTContext.
@@ -3124,8 +3130,8 @@
       (void)convertBlockPointerToFunctionPointer(t);
       ArgTypes.push_back(t);
     }
-    returnType = OMD->getResultType()->isObjCQualifiedIdType()
-                   ? Context->getObjCIdType() : OMD->getResultType();
+    returnType = Exp->getType();
+    convertToUnqualifiedObjCType(returnType);
     (void)convertBlockPointerToFunctionPointer(returnType);
   } else {
     returnType = Context->getObjCIdType();

Modified: cfe/trunk/test/Rewriter/instancetype-test.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/instancetype-test.mm?rev=139473&r1=139472&r2=139473&view=diff
==============================================================================
--- cfe/trunk/test/Rewriter/instancetype-test.mm (original)
+++ cfe/trunk/test/Rewriter/instancetype-test.mm Sat Sep 10 12:01:56 2011
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
 
 void *sel_registerName(const char *);
 
@@ -62,7 +63,8 @@
 
   // Exact type checks
   // Message sends to Class.
-  Subclass1<Proto1> *sc1proto1_2 = [[[sc1proto1 class] alloc] init];
+  // FIXME. This is not supported due to missing capability in rewriter and not due to instancetype issues
+  //  Subclass1<Proto1> *sc1proto1_2 = [[[sc1proto1 class] alloc] init];
 
   // Property access
   [sc1proto1.self methodInProto2]; // expected-warning{{method '-methodInProto2' not found (return type defaults to 'id')}}





More information about the cfe-commits mailing list