diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-12-22 01:30:46 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-12-22 01:30:46 +0000 |
commit | 299cfb7a02a9ee722655a1cc60e6a6af1371e0de (patch) | |
tree | 6499278fc49b05389ef7e4d013fd0b1f6c6b42c0 /clang/lib/Analysis/AnalysisDeclContext.cpp | |
parent | 2da9777cef1e432e61cb4ffe11c823574f28519f (diff) | |
download | bcm5719-llvm-299cfb7a02a9ee722655a1cc60e6a6af1371e0de.tar.gz bcm5719-llvm-299cfb7a02a9ee722655a1cc60e6a6af1371e0de.zip |
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.
llvm-svn: 147122
Diffstat (limited to 'clang/lib/Analysis/AnalysisDeclContext.cpp')
-rw-r--r-- | clang/lib/Analysis/AnalysisDeclContext.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/Analysis/AnalysisDeclContext.cpp b/clang/lib/Analysis/AnalysisDeclContext.cpp index 546cf98f689..96a92b4b5bc 100644 --- a/clang/lib/Analysis/AnalysisDeclContext.cpp +++ b/clang/lib/Analysis/AnalysisDeclContext.cpp @@ -353,7 +353,7 @@ public: Visit(child); } - void VisitDeclRefExpr(const DeclRefExpr *DR) { + void VisitDeclRefExpr(DeclRefExpr *DR) { // Non-local variables are also directly modified. if (const VarDecl *VD = dyn_cast<VarDecl>(DR->getDecl())) if (!VD->hasLocalStorage()) { @@ -381,6 +381,16 @@ public: IgnoredContexts.insert(BR->getBlockDecl()); Visit(BR->getBlockDecl()->getBody()); } + + void VisitPseudoObjectExpr(PseudoObjectExpr *PE) { + for (PseudoObjectExpr::semantics_iterator it = PE->semantics_begin(), + et = PE->semantics_end(); it != et; ++it) { + Expr *Semantic = *it; + if (OpaqueValueExpr *OVE = dyn_cast<OpaqueValueExpr>(Semantic)) + Semantic = OVE->getSourceExpr(); + Visit(Semantic); + } + } }; } // end anonymous namespace |