When creating PathDiagnostics, created a trimmed graph first and report the

BFS path to the root.  This also avoids problems with loops in the ExplodedGraph.

llvm-svn: 49133
This commit is contained in:
Ted Kremenek 2008-04-03 04:59:14 +00:00
parent 588dcdd58b
commit 4e9cc3f272
1 changed files with 19 additions and 1 deletions

View File

@ -69,8 +69,26 @@ void BugReporter::GeneratePathDiagnostic(PathDiagnostic& PD, ASTContext& Ctx,
SourceManager& SMgr = Ctx.getSourceManager();
llvm::OwningPtr<ExplodedGraph<GRExprEngine> > GTrim(G.Trim(&N, &N+1));
// Find the sink in the trimmed graph.
// FIXME: Should we eventually have a sink iterator?
ExplodedNode<ValueState>* NewN = 0;
for (ExplodedGraph<GRExprEngine>::node_iterator
I = GTrim->nodes_begin(), E = GTrim->nodes_end(); I != E; ++I) {
if (I->isSink()) {
NewN = &*I;
break;
}
}
assert (NewN);
assert (NewN->getLocation() == N->getLocation());
N = NewN;
while (!N->pred_empty()) {