diff options
| author | Ted Kremenek <kremenek@apple.com> | 2013-05-07 17:02:41 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2013-05-07 17:02:41 +0000 |
| commit | e2f7337958f21802e98777f441fe20ef7ba2adff (patch) | |
| tree | 43a0074221bb1f39d11389737a17ef220a9a486f /lib/StaticAnalyzer/Core/BugReporter.cpp | |
| parent | 5068b6f6bd166c50d045bf33901759a2417fdee4 (diff) | |
| download | clang-e2f7337958f21802e98777f441fe20ef7ba2adff.tar.gz clang-e2f7337958f21802e98777f441fe20ef7ba2adff.tar.bz2 clang-e2f7337958f21802e98777f441fe20ef7ba2adff.tar.xz | |
[analyzer; alternate arrows] The ForStmt increment is not a critical anchor for arrows.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181333 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/BugReporter.cpp')
| -rw-r--r-- | lib/StaticAnalyzer/Core/BugReporter.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/StaticAnalyzer/Core/BugReporter.cpp b/lib/StaticAnalyzer/Core/BugReporter.cpp index 2a4d410518..dd8aaae4f0 100644 --- a/lib/StaticAnalyzer/Core/BugReporter.cpp +++ b/lib/StaticAnalyzer/Core/BugReporter.cpp @@ -1848,6 +1848,13 @@ static bool isConditionForTerminator(const Stmt *S, const Stmt *Cond) { } } +static bool isIncrementInForLoop(const Stmt *S, const Stmt *FL) { + const ForStmt *FS = dyn_cast<ForStmt>(FL); + if (!FL) + return false; + return FS->getInc() == S; +} + typedef llvm::DenseSet<const PathDiagnosticCallPiece *> OptimizedCallsSet; @@ -1950,7 +1957,9 @@ static bool optimizeEdges(PathPieces &path, SourceManager &SM, // to prevent this optimization. // if (s1End && s1End == s2Start && - isa<Expr>(s1End) && PM.isConsumedExpr(cast<Expr>(s1End)) && + isa<Expr>(s1End) && + (PM.isConsumedExpr(cast<Expr>(s1End)) || + isIncrementInForLoop(s1End, level2)) && (!level2 || !isConditionForTerminator(level2, s1End))) { PieceI->setEndLocation(PieceNextI->getEndLocation()); path.erase(NextI); |
