[cfe-commits] r129171 - in /cfe/trunk: lib/Rewrite/RewriteObjC.cpp test/Rewriter/rewrite-block-literal-1.mm

Fariborz Jahanian fjahanian at apple.com
Fri Apr 8 16:48:30 PDT 2011


Author: fjahanian
Date: Fri Apr  8 18:48:29 2011
New Revision: 129171

URL: http://llvm.org/viewvc/llvm-project?rev=129171&view=rev
Log:
Fixes a rewrting bug of a property-dot syntax expression inside
a block. First part of // rdar://9254348

Added:
    cfe/trunk/test/Rewriter/rewrite-block-literal-1.mm
Modified:
    cfe/trunk/lib/Rewrite/RewriteObjC.cpp

Modified: cfe/trunk/lib/Rewrite/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/RewriteObjC.cpp?rev=129171&r1=129170&r2=129171&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Rewrite/RewriteObjC.cpp Fri Apr  8 18:48:29 2011
@@ -5558,6 +5558,7 @@
     // Rewrite the block body in place.
     Stmt *SaveCurrentBody = CurrentBody;
     CurrentBody = BE->getBody();
+    CollectPropertySetters(CurrentBody);
     PropParentMap = 0;
     RewriteFunctionBodyOrGlobalInitializer(BE->getBody());
     CurrentBody = SaveCurrentBody;

Added: cfe/trunk/test/Rewriter/rewrite-block-literal-1.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/rewrite-block-literal-1.mm?rev=129171&view=auto
==============================================================================
--- cfe/trunk/test/Rewriter/rewrite-block-literal-1.mm (added)
+++ cfe/trunk/test/Rewriter/rewrite-block-literal-1.mm Fri Apr  8 18:48:29 2011
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -Did="void *" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
+// radar 9254348
+
+void *sel_registerName(const char *);
+typedef void (^BLOCK_TYPE)(void);
+
+ at interface CoreDAVTaskGroup 
+{
+  int IVAR;
+}
+ at property int IVAR;
+- (void) setCompletionBlock : (BLOCK_TYPE) arg;
+ at end
+
+ at implementation CoreDAVTaskGroup
+- (void)_finishInitialSync {
+                    CoreDAVTaskGroup *folderPost;
+                    [folderPost setCompletionBlock : (^{
+			self.IVAR = 0;
+                    })];
+}
+ at dynamic IVAR;
+- (void) setCompletionBlock : (BLOCK_TYPE) arg {}
+ at end
+
+





More information about the cfe-commits mailing list