From: Fariborz Jahanian Date: Fri, 8 Apr 2011 23:48:29 +0000 (+0000) Subject: Fixes a rewrting bug of a property-dot syntax expression inside X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=36178092294301d26b8c77f755dae9489a9a722c;p=clang Fixes a rewrting bug of a property-dot syntax expression inside a block. First part of // rdar://9254348 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129171 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Rewrite/RewriteObjC.cpp b/lib/Rewrite/RewriteObjC.cpp index 13cd671f12..298ed9a906 100644 --- a/lib/Rewrite/RewriteObjC.cpp +++ b/lib/Rewrite/RewriteObjC.cpp @@ -5558,6 +5558,7 @@ Stmt *RewriteObjC::RewriteFunctionBodyOrGlobalInitializer(Stmt *S) { // Rewrite the block body in place. Stmt *SaveCurrentBody = CurrentBody; CurrentBody = BE->getBody(); + CollectPropertySetters(CurrentBody); PropParentMap = 0; RewriteFunctionBodyOrGlobalInitializer(BE->getBody()); CurrentBody = SaveCurrentBody; diff --git a/test/Rewriter/rewrite-block-literal-1.mm b/test/Rewriter/rewrite-block-literal-1.mm new file mode 100644 index 0000000000..681d2ff077 --- /dev/null +++ b/test/Rewriter/rewrite-block-literal-1.mm @@ -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); + +@interface CoreDAVTaskGroup +{ + int IVAR; +} +@property int IVAR; +- (void) setCompletionBlock : (BLOCK_TYPE) arg; +@end + +@implementation CoreDAVTaskGroup +- (void)_finishInitialSync { + CoreDAVTaskGroup *folderPost; + [folderPost setCompletionBlock : (^{ + self.IVAR = 0; + })]; +} +@dynamic IVAR; +- (void) setCompletionBlock : (BLOCK_TYPE) arg {} +@end + +