[analyzer;alternate edges] - add in events (loop iterations, etc)

These were being dropped due a transcription mistake from the original
algorithm.

llvm-svn: 181083
This commit is contained in:
Ted Kremenek 2013-05-04 01:12:55 +00:00
parent 881e9d62e2
commit 74c0d388e8
1 changed files with 15 additions and 7 deletions

View File

@ -1595,6 +1595,12 @@ GenerateAlternateExtensivePathDiagnostic(PathDiagnostic& PD,
reversePropagateIntererstingSymbols(*PDB.getBugReport(), IE, reversePropagateIntererstingSymbols(*PDB.getBugReport(), IE,
N->getState().getPtr(), Ex, N->getState().getPtr(), Ex,
N->getLocationContext()); N->getLocationContext());
PathDiagnosticLocation L =
cleanUpLocation(PathDiagnosticLocation::createBegin(PS->getStmt(), SM,
LC), LC);
addEdgeToPath(PD.getActivePath(), PrevLoc, L, LC);
break; break;
} }
@ -1686,6 +1692,7 @@ GenerateAlternateExtensivePathDiagnostic(PathDiagnostic& PD,
p->setPrunable(true); p->setPrunable(true);
addEdgeToPath(PD.getActivePath(), PrevLoc, p->getLocation(), LC); addEdgeToPath(PD.getActivePath(), PrevLoc, p->getLocation(), LC);
PD.getActivePath().push_front(p);
if (CS) { if (CS) {
addEdgeToPath(PD.getActivePath(), PrevLoc, addEdgeToPath(PD.getActivePath(), PrevLoc,
@ -1706,12 +1713,13 @@ GenerateAlternateExtensivePathDiagnostic(PathDiagnostic& PD,
N), N),
Term)) Term))
{ {
PathDiagnosticLocation L(Term, SM, PDB.LC); PathDiagnosticLocation L(Term, SM, PDB.LC);
PathDiagnosticEventPiece *PE = PathDiagnosticEventPiece *PE =
new PathDiagnosticEventPiece(L, "Loop body executed 0 times"); new PathDiagnosticEventPiece(L, "Loop body executed 0 times");
PE->setPrunable(true); PE->setPrunable(true);
addEdgeToPath(PD.getActivePath(), PrevLoc, addEdgeToPath(PD.getActivePath(), PrevLoc,
PE->getLocation(), LC); PE->getLocation(), LC);
PD.getActivePath().push_front(PE);
} }
} }
break; break;
@ -1722,12 +1730,12 @@ GenerateAlternateExtensivePathDiagnostic(PathDiagnostic& PD,
continue; continue;
// Add pieces from custom visitors. // Add pieces from custom visitors.
BugReport *R = PDB.getBugReport();
for (ArrayRef<BugReporterVisitor *>::iterator I = visitors.begin(), for (ArrayRef<BugReporterVisitor *>::iterator I = visitors.begin(),
E = visitors.end(); E = visitors.end();
I != E; ++I) { I != E; ++I) {
if (PathDiagnosticPiece *p = (*I)->VisitNode(N, NextNode, PDB, *R)) { if (PathDiagnosticPiece *p = (*I)->VisitNode(N, NextNode, PDB, *report)) {
addEdgeToPath(PD.getActivePath(), PrevLoc, p->getLocation(), LC); addEdgeToPath(PD.getActivePath(), PrevLoc, p->getLocation(), LC);
PD.getActivePath().push_front(p);
updateStackPiecesWithMessage(p, CallStack); updateStackPiecesWithMessage(p, CallStack);
} }
} }