From: Ted Kremenek Date: Tue, 7 May 2013 21:12:00 +0000 (+0000) Subject: [analyzer; alternate arrows] remove pruning of loop diagnostics. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b17c2f79093317a0bf3017350347170dd1061f49;p=clang [analyzer; alternate arrows] remove pruning of loop diagnostics. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181360 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/StaticAnalyzer/Core/BugReporter.cpp b/lib/StaticAnalyzer/Core/BugReporter.cpp index f4aa9ef6f4..c63afc1411 100644 --- a/lib/StaticAnalyzer/Core/BugReporter.cpp +++ b/lib/StaticAnalyzer/Core/BugReporter.cpp @@ -1566,45 +1566,6 @@ static void addEdgeToPath(PathPieces &path, PrevLoc = NewLoc; } -enum EventCategorization { EC_None, EC_EnterLoop, EC_LoopingBack }; - -typedef llvm::DenseMap - EventCategoryMap; - - -static void pruneLoopEvents(PathPieces &path, EventCategoryMap &ECM) { - for (PathPieces::iterator I = path.begin(), E = path.end(); I != E; ++I) { - if (PathDiagnosticCallPiece *call = dyn_cast(*I)) { - pruneLoopEvents(call->path, ECM); - continue; - } - - PathDiagnosticEventPiece *I_event = dyn_cast(*I); - if (!I_event || ECM[I_event] != EC_LoopingBack) - continue; - - PathPieces::iterator Next = I; ++Next; - PathDiagnosticEventPiece *Next_event = 0; - for ( ; Next != E ; ++Next) { - Next_event = dyn_cast(*Next); - if (Next_event) - break; - } - - if (Next_event) { - EventCategorization E = ECM[Next_event]; - if (E == EC_EnterLoop) { - PathDiagnosticLocation L = I_event->getLocation(); - PathDiagnosticLocation L_next = Next_event->getLocation(); - if (L == L_next) { - path.erase(Next); - } - } - } - } -} - static bool GenerateAlternateExtensivePathDiagnostic(PathDiagnostic& PD, PathDiagnosticBuilder &PDB, @@ -1621,8 +1582,6 @@ GenerateAlternateExtensivePathDiagnostic(PathDiagnostic& PD, llvm::DenseMap PrevLocMap; - EventCategoryMap EventCategory; - const ExplodedNode *NextNode = N->getFirstPred(); while (NextNode) { N = NextNode; @@ -1731,7 +1690,6 @@ GenerateAlternateExtensivePathDiagnostic(PathDiagnostic& PD, addEdgeToPath(PD.getActivePath(), PrevLoc, p->getLocation(), LC); PD.getActivePath().push_front(p); - EventCategory[p] = EC_LoopingBack; } const CFGBlock *BSrc = BE->getSrc(); @@ -1746,7 +1704,6 @@ GenerateAlternateExtensivePathDiagnostic(PathDiagnostic& PD, isInLoopBody(PM, getStmtBeforeCond(PM, TermCond, N), Term); const char *str = 0; - enum EventCategorization EC = EC_None; if (isJumpToFalseBranch(&*BE)) { if (!IsInLoopBody) { @@ -1755,14 +1712,12 @@ GenerateAlternateExtensivePathDiagnostic(PathDiagnostic& PD, } else { str = "Entering loop body"; - EC = EC_EnterLoop; } if (str) { PathDiagnosticLocation L(TermCond, SM, PDB.LC); PathDiagnosticEventPiece *PE = new PathDiagnosticEventPiece(L, str); - EventCategory[PE] = EC; PE->setPrunable(true); addEdgeToPath(PD.getActivePath(), PrevLoc, PE->getLocation(), LC); @@ -1794,11 +1749,6 @@ GenerateAlternateExtensivePathDiagnostic(PathDiagnostic& PD, } } - if (report->isValid()) { - // Prune redundant loop diagnostics. - pruneLoopEvents(PD.getMutablePieces(), EventCategory); - } - return report->isValid(); }