]> granicus.if.org Git - clang/commitdiff
Tweaker Checker::VisitEndAnalysis to have 'hasWorkRemaining' also
authorTed Kremenek <kremenek@apple.com>
Tue, 29 Jun 2010 21:58:54 +0000 (21:58 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 29 Jun 2010 21:58:54 +0000 (21:58 +0000)
be true if some paths were aborted because they exceeded
the maximum loop unrolling count.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107209 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Checker/PathSensitive/GRCoreEngine.h
lib/Checker/GRCoreEngine.cpp

index 2d8afeeb0da616f69fd8e11d377b11c3f6fbde38..936f18b97b5c910c44d1756f361230e4d27bc804 100644 (file)
@@ -57,6 +57,10 @@ class GRCoreEngine {
   ///   These are used to record for key nodes in the ExplodedGraph the
   ///   number of times different CFGBlocks have been visited along a path.
   GRBlockCounter::Factory BCounterFactory;
+  
+  /// A flag that indicates whether paths were halted because 
+  ///  ProcessBlockEntrace returned false. 
+  bool BlockAborted;
 
   void GenerateNode(const ProgramPoint& Loc, const GRState* State,
                     ExplodedNode* Pred);
@@ -108,14 +112,16 @@ public:
   GRCoreEngine(ASTContext& ctx, GRSubEngine& subengine)
     : SubEngine(subengine), G(new ExplodedGraph(ctx)),
       WList(GRWorkList::MakeBFS()),
-      BCounterFactory(G->getAllocator()) {}
+      BCounterFactory(G->getAllocator()),
+      BlockAborted(false) {}
 
   /// Construct a GRCoreEngine object to analyze the provided CFG and to
   ///  use the provided worklist object to execute the worklist algorithm.
   ///  The GRCoreEngine object assumes ownership of 'wlist'.
   GRCoreEngine(ASTContext& ctx, GRWorkList* wlist, GRSubEngine& subengine)
     : SubEngine(subengine), G(new ExplodedGraph(ctx)), WList(wlist),
-      BCounterFactory(G->getAllocator()) {}
+      BCounterFactory(G->getAllocator()),
+      BlockAborted(false) {}
 
   ~GRCoreEngine() {
     delete WList;
index 36f330303c372758cd1c3243cd0e3cfeade84e12..a816186a307ddf139d9bda9f5977d204b39977de 100644 (file)
@@ -221,7 +221,7 @@ bool GRCoreEngine::ExecuteWorkList(const LocationContext *L, unsigned Steps) {
     }
   }
 
-  SubEngine.ProcessEndWorklist(WList->hasWork());
+  SubEngine.ProcessEndWorklist(WList->hasWork() || BlockAborted);
   return WList->hasWork();
 }
 
@@ -258,7 +258,10 @@ void GRCoreEngine::HandleBlockEdge(const BlockEdge& L, ExplodedNode* Pred) {
   // FIXME: Should we allow ProcessBlockEntrance to also manipulate state?
 
   if (ProcessBlockEntrance(Blk, Pred, WList->getBlockCounter()))
-    GenerateNode(BlockEntrance(Blk, Pred->getLocationContext()), Pred->State, Pred);
+    GenerateNode(BlockEntrance(Blk, Pred->getLocationContext()),
+                 Pred->State, Pred);
+  else
+    BlockAborted = true;
 }
 
 void GRCoreEngine::HandleBlockEntrance(const BlockEntrance& L,