diff options
author | Ted Kremenek <kremenek@apple.com> | 2013-05-22 19:10:41 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2013-05-22 19:10:41 +0000 |
commit | 0962e56f00f212483f0f4edb0113f279a967e7e4 (patch) | |
tree | 11ff0ab3b679a3bdee70fc307cbb785c4afb4676 /clang/lib/StaticAnalyzer/Core/BugReporter.cpp | |
parent | ef6fca5536225f670d2556b064d50d5db1526212 (diff) | |
download | bcm5719-llvm-0962e56f00f212483f0f4edb0113f279a967e7e4.tar.gz bcm5719-llvm-0962e56f00f212483f0f4edb0113f279a967e7e4.zip |
[analyzer; alternate edges] remove redundant adjacent "events" with the same text.
Fixes <rdar://problem/13949982>
llvm-svn: 182505
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/BugReporter.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/BugReporter.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp index 9663492a14c..f08e048bb80 100644 --- a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp +++ b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp @@ -2026,6 +2026,31 @@ static void removePunyEdges(PathPieces &path, } } +static void removeIdenticalEvents(PathPieces &path) { + for (PathPieces::iterator I = path.begin(), E = path.end(); I != E; ++I) { + PathDiagnosticEventPiece *PieceI = + dyn_cast<PathDiagnosticEventPiece>(*I); + + if (!PieceI) + continue; + + PathPieces::iterator NextI = I; ++NextI; + if (NextI == E) + return; + + PathDiagnosticEventPiece *PieceNextI = + dyn_cast<PathDiagnosticEventPiece>(*I); + + if (!PieceNextI) + continue; + + // Erase the second piece if it has the same exact message text. + if (PieceI->getString() == PieceNextI->getString()) { + path.erase(NextI); + } + } +} + static bool optimizeEdges(PathPieces &path, SourceManager &SM, OptimizedCallsSet &OCS, LocationContextMap &LCM) { @@ -2199,6 +2224,8 @@ static bool optimizeEdges(PathPieces &path, SourceManager &SM, if (!hasChanges) { // Remove any puny edges left over after primary optimization pass. removePunyEdges(path, SM, PM); + // Remove identical events. + removeIdenticalEvents(path); } return hasChanges; |