Enhance AnalysisDeclContext::getReferencedBlockVars() to understand PseudoObjExprs. It turns out
that the information collected by this method is a super set of the captured variables in BlockDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147122 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/LiveVariables.cpp b/lib/Analysis/LiveVariables.cpp
index 89cf9f8..ff6607d 100644
--- a/lib/Analysis/LiveVariables.cpp
+++ b/lib/Analysis/LiveVariables.cpp
@@ -354,10 +354,11 @@
}
void TransferFunctions::VisitBlockExpr(BlockExpr *BE) {
- const BlockDecl *BD = BE->getBlockDecl();
- for (BlockDecl::capture_const_iterator it = BD->capture_begin(),
- ei = BD->capture_end(); it != ei; ++it) {
- const VarDecl *VD = it->getVariable();
+ AnalysisDeclContext::referenced_decls_iterator I, E;
+ llvm::tie(I, E) =
+ LV.analysisContext.getReferencedBlockVars(BE->getBlockDecl());
+ for ( ; I != E ; ++I) {
+ const VarDecl *VD = *I;
if (isAlwaysAlive(VD))
continue;
val.liveDecls = LV.DSetFact.add(val.liveDecls, VD);