aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Analysis/AnalysisDeclContext.cpp11
-rw-r--r--test/Analysis/blocks.m6
2 files changed, 10 insertions, 7 deletions
diff --git a/lib/Analysis/AnalysisDeclContext.cpp b/lib/Analysis/AnalysisDeclContext.cpp
index 83d441e812..bcaad9b0db 100644
--- a/lib/Analysis/AnalysisDeclContext.cpp
+++ b/lib/Analysis/AnalysisDeclContext.cpp
@@ -402,9 +402,6 @@ public:
if (!VD->hasLocalStorage()) {
if (Visited.insert(VD))
BEVals.push_back(VD, BC);
- } else if (DR->refersToEnclosingLocal()) {
- if (Visited.insert(VD) && IsTrackedDecl(VD))
- BEVals.push_back(VD, BC);
}
}
}
@@ -439,7 +436,13 @@ static DeclVec* LazyInitializeReferencedDecls(const BlockDecl *BD,
DeclVec *BV = (DeclVec*) A.Allocate<DeclVec>();
new (BV) DeclVec(BC, 10);
- // Find the referenced variables.
+ // Go through the capture list.
+ for (BlockDecl::capture_const_iterator CI = BD->capture_begin(),
+ CE = BD->capture_end(); CI != CE; ++CI) {
+ BV->push_back(CI->getVariable(), BC);
+ }
+
+ // Find the referenced global/static variables.
FindBlockDeclRefExprsVals F(*BV, BC);
F.Visit(BD->getBody());
diff --git a/test/Analysis/blocks.m b/test/Analysis/blocks.m
index 8aa65a371e..2fa5a8e1a8 100644
--- a/test/Analysis/blocks.m
+++ b/test/Analysis/blocks.m
@@ -97,7 +97,6 @@ void testMessaging() {
}
-// FALSE POSITIVE <rdar://problem/12415065>
@interface rdar12415065 : NSObject
@end
@@ -112,8 +111,9 @@ void testMessaging() {
if (!queue)
return;
- // FALSE POSITIVE
- // expected-warning@+1 {{Variable 'x' is uninitialized when captured by block}}
+ // This previously was a false positive with 'x' being flagged as being
+ // uninitialized when captured by the exterior block (when it is only
+ // captured by the interior block).
dispatch_async(queue, ^{
double x = 0.0;
if (24.0f < x) {