aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Frontend/RewriteObjC.cpp1
-rw-r--r--test/Rewriter/rewrite-nested-blocks.mm18
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/Frontend/RewriteObjC.cpp b/lib/Frontend/RewriteObjC.cpp
index 0895585e79..26b32478b8 100644
--- a/lib/Frontend/RewriteObjC.cpp
+++ b/lib/Frontend/RewriteObjC.cpp
@@ -4374,6 +4374,7 @@ void RewriteObjC::GetInnerBlockDeclRefExprs(Stmt *S,
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);
diff --git a/test/Rewriter/rewrite-nested-blocks.mm b/test/Rewriter/rewrite-nested-blocks.mm
index 95a16bdbb3..1a6bcdde61 100644
--- a/test/Rewriter/rewrite-nested-blocks.mm
+++ b/test/Rewriter/rewrite-nested-blocks.mm
@@ -36,3 +36,21 @@ void foo () {
});
});
}
+
+// radar 7692419
+@interface Bar
+@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);
+}