Renamed GRConstants => GRSimpleVals.
Moved driver logic for --grsimple to GRSimpleVals.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47137 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Analysis/GRSimpleVals.cpp b/Analysis/GRSimpleVals.cpp
index 200c9a3..490ed7f 100644
--- a/Analysis/GRSimpleVals.cpp
+++ b/Analysis/GRSimpleVals.cpp
@@ -14,9 +14,39 @@
 //===----------------------------------------------------------------------===//
 
 #include "GRSimpleVals.h"
+#include "clang/Basic/Diagnostic.h"
 
 using namespace clang;
 
+namespace clang {
+  void RunGRSimpleVals(CFG& cfg, FunctionDecl& FD, ASTContext& Ctx,
+                      Diagnostic& Diag) {
+    
+    GRCoreEngine<GRExprEngine> Engine(cfg, FD, Ctx);
+    GRExprEngine* CheckerState = &Engine.getCheckerState();
+    GRSimpleVals GRSV;
+    CheckerState->setTransferFunctions(GRSV);
+    
+    // Execute the worklist algorithm.
+    Engine.ExecuteWorkList();
+    
+    // Look for explicit-Null dereferences and warn about them.
+    for (GRExprEngine::null_iterator I=CheckerState->null_begin(),
+         E=CheckerState->null_end(); I!=E; ++I) {
+      
+      const PostStmt& L = cast<PostStmt>((*I)->getLocation());
+      Expr* E = cast<Expr>(L.getStmt());
+      
+      Diag.Report(FullSourceLoc(E->getExprLoc(), Ctx.getSourceManager()),
+                  diag::chkr_null_deref_after_check);
+    }
+        
+#ifndef NDEBUG
+    CheckerState->ViewGraph();
+#endif  
+  }
+} // end clang namespace
+
 //===----------------------------------------------------------------------===//
 // Transfer function for Casts.
 //===----------------------------------------------------------------------===//