We now delay adding nodes created by GRBranchNodeBuilder to the analysis
worklist until the dstor of GRBranchNodeBuilderImpl. This way clients can mark
creates nodes as "sinks" before they are added to the worklist.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46582 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Analysis/GRConstants.cpp b/Analysis/GRConstants.cpp
index 6d5bdbd..36ad5fe 100644
--- a/Analysis/GRConstants.cpp
+++ b/Analysis/GRConstants.cpp
@@ -842,6 +842,10 @@
     
     return St;
   }
+  
+  bool isUninitControlFlow(const NodeTy* N) const {
+    return N->isSink() && UninitBranches.count(const_cast<NodeTy*>(N)) != 0;
+  }
 
   /// ProcessStmt - Called by GREngine. Used to generate new successor
   ///  nodes by processing the 'effects' of a block-level statement.
@@ -1474,6 +1478,8 @@
 //===----------------------------------------------------------------------===//
 
 #ifndef NDEBUG
+static GRConstants* GraphPrintCheckerState;
+
 namespace llvm {
 template<>
 struct VISIBILITY_HIDDEN DOTGraphTraits<GRConstants::NodeTy*> :
@@ -1566,6 +1572,10 @@
           
           Out << "\\l";
         }
+        
+        if (GraphPrintCheckerState->isUninitControlFlow(N)) {
+          Out << "\\|Control-flow based on\\lUninitialized value.\\l";
+        }
       }
     }
     
@@ -1587,7 +1597,9 @@
   GREngine<GRConstants> Engine(cfg, FD, Ctx);
   Engine.ExecuteWorkList();  
 #ifndef NDEBUG
+  GraphPrintCheckerState = &Engine.getCheckerState();
   llvm::ViewGraph(*Engine.getGraph().roots_begin(),"GRConstants");
+  GraphPrintCheckerState = NULL;
 #endif  
 }
 } // end clang namespace