[cfe-commits] r97244 - in /cfe/trunk: lib/Frontend/RewriteObjC.cpp test/Rewriter/rewrite-nested-blocks.mm

Fariborz Jahanian fjahanian at apple.com
Fri Feb 26 11:05:20 PST 2010


Author: fjahanian
Date: Fri Feb 26 13:05:20 2010
New Revision: 97244

URL: http://llvm.org/viewvc/llvm-project?rev=97244&view=rev
Log:
Rewriting of imported variable from outer
blocks's argument in the inner block requires special treatment.
Fixes radar 7692419.


Modified:
    cfe/trunk/lib/Frontend/RewriteObjC.cpp
    cfe/trunk/test/Rewriter/rewrite-nested-blocks.mm

Modified: cfe/trunk/lib/Frontend/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/RewriteObjC.cpp?rev=97244&r1=97243&r2=97244&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Frontend/RewriteObjC.cpp Fri Feb 26 13:05:20 2010
@@ -4374,6 +4374,7 @@
   if (BlockDeclRefExpr *CDRE = dyn_cast<BlockDeclRefExpr>(S))
     if (!isa<FunctionDecl>(CDRE->getDecl()) &&
         !CDRE->isByRef() &&
+        !isa<ParmVarDecl>(CDRE->getDecl()) &&
         !InnerBlockValueDecls.count(CDRE->getDecl())) {
       InnerBlockValueDecls.insert(CDRE->getDecl());
       InnerBlockDeclRefs.push_back(CDRE);

Modified: cfe/trunk/test/Rewriter/rewrite-nested-blocks.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/rewrite-nested-blocks.mm?rev=97244&r1=97243&r2=97244&view=diff
==============================================================================
--- cfe/trunk/test/Rewriter/rewrite-nested-blocks.mm (original)
+++ cfe/trunk/test/Rewriter/rewrite-nested-blocks.mm Fri Feb 26 13:05:20 2010
@@ -36,3 +36,21 @@
 		});
 	});
 }
+
+// radar 7692419
+ at interface Bar
+ at end
+
+void f(Bar *);
+void q(void (^block)(void));
+
+void x() {
+        void (^myblock)(Bar *b) = ^(Bar *b) {
+                q(^{
+                        f(b);   
+                });
+        };
+        
+        Bar *b = (Bar *)42;
+        myblock(b);
+}





More information about the cfe-commits mailing list