]> granicus.if.org Git - clang/commitdiff
When dispatching to Checker objects in GRExprEngine::CheckerVisit(),
authorTed Kremenek <kremenek@apple.com>
Wed, 25 Nov 2009 21:40:22 +0000 (21:40 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 25 Nov 2009 21:40:22 +0000 (21:40 +0000)
only stop processing the checkers after all the nodes for a current
check have been processed.  This (I believe) handles the case where
PredSet (the input nodes) contains more than one node due to state
bifurcation.  Zhongxing: can you review this?

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

lib/Analysis/GRExprEngine.cpp

index 11ea5f8f3f9c3b7e1d938afc57a2ce1889f0c5c1..403126c471acd392d6b564a704adf8d34b0793c4 100644 (file)
@@ -118,6 +118,7 @@ bool GRExprEngine::CheckerVisit(Stmt *S, ExplodedNodeSet &Dst,
 
   ExplodedNodeSet Tmp;
   ExplodedNodeSet *PrevSet = &Src;
+  bool stopProcessingAfterCurrentChecker = false;
 
   for (CheckersOrdered::iterator I=Checkers.begin(),E=Checkers.end(); I!=E; ++I)
   {
@@ -127,20 +128,27 @@ bool GRExprEngine::CheckerVisit(Stmt *S, ExplodedNodeSet &Dst,
     CurrSet->clear();
     void *tag = I->first;
     Checker *checker = I->second;
-
+    
     for (ExplodedNodeSet::iterator NI = PrevSet->begin(), NE = PrevSet->end();
          NI != NE; ++NI) {
       // FIXME: Halting evaluation of the checkers is something we may
-      // not support later.  The design is still evolving.
+      // not support later.  The design is still evolving.      
       if (checker->GR_Visit(*CurrSet, *Builder, *this, S, *NI,
                             tag, isPrevisit)) {
         if (CurrSet != &Dst)
           Dst.insert(*CurrSet);
-        return true;
+
+        stopProcessingAfterCurrentChecker = true;
+        continue;
       }
+      assert(stopProcessingAfterCurrentChecker == false &&
+             "Inconsistent setting of 'stopProcessingAfterCurrentChecker'");
     }
+    
+    if (stopProcessingAfterCurrentChecker)
+      return true;
 
-    // Update which NodeSet is the current one.
+    // Continue on to the next checker.  Update the current NodeSet.
     PrevSet = CurrSet;
   }