diff options
author | Ted Kremenek <kremenek@apple.com> | 2012-12-06 07:17:26 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2012-12-06 07:17:26 +0000 |
commit | b929f6636c79565e9a34c0656a962f9b198c5e80 (patch) | |
tree | 5c04ad74242b918e747a25b81d47c5ec75f1fe5c /lib/Analysis/AnalysisDeclContext.cpp | |
parent | e3ce2c10c3f6ae7b26700d758de909deab190d42 (diff) |
Use the BlockDecl captures list to infer the direct captures for a BlockDataRegion. Fixes <rdar://problem/12415065>.
We still need to do a recursive walk to determine all static/global variables
referenced by a block, which is needed for region invalidation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169481 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/AnalysisDeclContext.cpp')
-rw-r--r-- | lib/Analysis/AnalysisDeclContext.cpp | 11 |
1 files changed, 7 insertions, 4 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()); |