diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2011-08-02 20:28:46 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2011-08-02 20:28:46 +0000 |
commit | c7c346fd13a4148bda651a5be382ae605573c97b (patch) | |
tree | 218c0239134e1ad68efb2d2922eddf1e7681cb67 /clang/lib/Rewrite/RewriteObjC.cpp | |
parent | c48e10cd548e731666e46f6bb05348a44b819ba0 (diff) | |
download | bcm5719-llvm-c7c346fd13a4148bda651a5be382ae605573c97b.tar.gz bcm5719-llvm-c7c346fd13a4148bda651a5be382ae605573c97b.zip |
objective-c rewrite: Fixes rewriting of objective-c collection
statement inside a block. // rdar://9878420
llvm-svn: 136717
Diffstat (limited to 'clang/lib/Rewrite/RewriteObjC.cpp')
-rw-r--r-- | clang/lib/Rewrite/RewriteObjC.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/Rewrite/RewriteObjC.cpp b/clang/lib/Rewrite/RewriteObjC.cpp index a27fac7258f..63e2084686f 100644 --- a/clang/lib/Rewrite/RewriteObjC.cpp +++ b/clang/lib/Rewrite/RewriteObjC.cpp @@ -5577,12 +5577,20 @@ Stmt *RewriteObjC::RewriteFunctionBodyOrGlobalInitializer(Stmt *S) { CurrentBody = BE->getBody(); CollectPropertySetters(CurrentBody); PropParentMap = 0; + // block literal on rhs of a property-dot-sytax assignment + // must be replaced by its synthesize ast so getRewrittenText + // works as expected. In this case, what actually ends up on RHS + // is the blockTranscribed which is the helper function for the + // block literal; as in: self.c = ^() {[ace ARR];}; + bool saveDisableReplaceStmt = DisableReplaceStmt; + DisableReplaceStmt = false; RewriteFunctionBodyOrGlobalInitializer(BE->getBody()); + DisableReplaceStmt = saveDisableReplaceStmt; CurrentBody = SaveCurrentBody; PropParentMap = 0; ImportedLocalExternalDecls.clear(); // Now we snarf the rewritten text and stash it away for later use. - std::string Str = Rewrite.ConvertToString(BE->getBody()); + std::string Str = Rewrite.getRewrittenText(BE->getSourceRange()); RewrittenBlockExprs[BE] = Str; Stmt *blockTranscribed = SynthBlockInitExpr(BE, InnerBlockDeclRefs); |