We don't care about the old algorithm. It will go away in the near future. That's why I put it in optimizeEdges, which is where it belong is the old algorithm didn't exist.
On May 22, 2013, at 12:14 PM, Jordan Rose <[email protected]> wrote: > This isn't really specific to the new edge generation, is it? Why put it in > optimizeEdges? > > (We already have removeRedundantMsgs for another set of, uh, redundant > messages.) > > Jordan > > > On May 22, 2013, at 12:10 , Ted Kremenek <[email protected]> wrote: > >> Author: kremenek >> Date: Wed May 22 14:10:41 2013 >> New Revision: 182505 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=182505&view=rev >> Log: >> [analyzer; alternate edges] remove redundant adjacent "events" with the same >> text. >> >> Fixes <rdar://problem/13949982> >> >> Modified: >> cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp >> >> Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp?rev=182505&r1=182504&r2=182505&view=diff >> ============================================================================== >> --- cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp (original) >> +++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp Wed May 22 14:10:41 >> 2013 >> @@ -2026,6 +2026,31 @@ static void removePunyEdges(PathPieces & >> } >> } >> >> +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 &pa >> if (!hasChanges) { >> // Remove any puny edges left over after primary optimization pass. >> removePunyEdges(path, SM, PM); >> + // Remove identical events. >> + removeIdenticalEvents(path); >> } >> >> return hasChanges; >> >> >> _______________________________________________ >> cfe-commits mailing list >> [email protected] >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
