diff options
author | Steven Wu <stevenwu@apple.com> | 2016-03-10 02:02:48 +0000 |
---|---|---|
committer | Steven Wu <stevenwu@apple.com> | 2016-03-10 02:02:48 +0000 |
commit | 92910f69a06e299beafb537ca08bc63e75a38612 (patch) | |
tree | efec00fb23fa0cb706f34db8bb4cd446de8ad42e /clang/lib/Sema | |
parent | 09b4a8daa354382c294e736fc9db018621376728 (diff) | |
download | bcm5719-llvm-92910f69a06e299beafb537ca08bc63e75a38612.tar.gz bcm5719-llvm-92910f69a06e299beafb537ca08bc63e75a38612.zip |
Fix false positives for for-loop-analysis warning
Summary:
For PseudoObjectExpr, the DeclMatcher need to search only all the semantics
but also need to search pass OpaqueValueExpr for all potential uses for the
Decl.
Reviewers: thakis, rtrieu, rjmccall, doug.gregor
Subscribers: xazax.hun, rjmccall, doug.gregor, cfe-commits
Differential Revision: http://reviews.llvm.org/D17627
llvm-svn: 263087
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r-- | clang/lib/Sema/SemaStmt.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp index b73b4f08841..1975fcb1102 100644 --- a/clang/lib/Sema/SemaStmt.cpp +++ b/clang/lib/Sema/SemaStmt.cpp @@ -1440,6 +1440,18 @@ namespace { FoundDecl = true; } + void VisitPseudoObjectExpr(PseudoObjectExpr *POE) { + // Only need to visit the semantics for POE. + // SyntaticForm doesn't really use the Decal. + for (auto *S : POE->semantics()) { + if (auto *OVE = dyn_cast<OpaqueValueExpr>(S)) + // Look past the OVE into the expression it binds. + Visit(OVE->getSourceExpr()); + else + Visit(S); + } + } + bool FoundDeclInUse() { return FoundDecl; } }; // end class DeclMatcher |