diff options
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 6 | ||||
-rw-r--r-- | test/SemaObjC/warn-retain-cycle.m | 4 |
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index 137f3e1a5e..6d6461136b 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -5253,6 +5253,12 @@ namespace { if (block->getBlockDecl()->capturesVariable(Variable)) Visit(block->getBlockDecl()->getBody()); } + + void VisitOpaqueValueExpr(OpaqueValueExpr *OVE) { + if (Capturer) return; + if (OVE->getSourceExpr()) + Visit(OVE->getSourceExpr()); + } }; } diff --git a/test/SemaObjC/warn-retain-cycle.m b/test/SemaObjC/warn-retain-cycle.m index 00fd234a0c..44d450a310 100644 --- a/test/SemaObjC/warn-retain-cycle.m +++ b/test/SemaObjC/warn-retain-cycle.m @@ -24,6 +24,10 @@ void test0(Test0 *x) { [weakx addBlock: ^{ [x actNow]; }]; [weakx setBlock: ^{ [x actNow]; }]; weakx.block = ^{ [x actNow]; }; + + // rdar://11702054 + x.block = ^{ (void)x.actNow; }; // expected-warning {{capturing 'x' strongly in this block is likely to lead to a retain cycle}} \ + // expected-note {{block will be retained by the captured object}} } @interface BlockOwner |