[cfe-commits] r49133 - /cfe/trunk/lib/Analysis/BugReporter.cpp

Ted Kremenek kremenek at apple.com
Wed Apr 2 21:59:15 PDT 2008


Author: kremenek
Date: Wed Apr  2 23:59:14 2008
New Revision: 49133

URL: http://llvm.org/viewvc/llvm-project?rev=49133&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/Analysis/BugReporter.cpp

Modified: cfe/trunk/lib/Analysis/BugReporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/BugReporter.cpp?rev=49133&r1=49132&r2=49133&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/BugReporter.cpp (original)
+++ cfe/trunk/lib/Analysis/BugReporter.cpp Wed Apr  2 23:59:14 2008
@@ -69,8 +69,26 @@
   
   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()) {
     





More information about the cfe-commits mailing list