Rename GRState to ProgramState, and cleanup some code formatting along the way.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137665 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/StaticAnalyzer/Core/BasicConstraintManager.cpp b/lib/StaticAnalyzer/Core/BasicConstraintManager.cpp
index b9f145e..4e21311 100644
--- a/lib/StaticAnalyzer/Core/BasicConstraintManager.cpp
+++ b/lib/StaticAnalyzer/Core/BasicConstraintManager.cpp
@@ -8,13 +8,13 @@
 //===----------------------------------------------------------------------===//
 //
 //  This file defines BasicConstraintManager, a class that tracks simple
-//  equality and inequality constraints on symbolic values of GRState.
+//  equality and inequality constraints on symbolic values of ProgramState.
 //
 //===----------------------------------------------------------------------===//
 
 #include "SimpleConstraintManager.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/GRState.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/GRStateTrait.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/TransferFuncs.h"
 #include "llvm/Support/raw_ostream.h"
 
@@ -25,7 +25,7 @@
 namespace { class ConstNotEq {}; }
 namespace { class ConstEq {}; }
 
-typedef llvm::ImmutableMap<SymbolRef,GRState::IntSetTy> ConstNotEqTy;
+typedef llvm::ImmutableMap<SymbolRef,ProgramState::IntSetTy> ConstNotEqTy;
 typedef llvm::ImmutableMap<SymbolRef,const llvm::APSInt*> ConstEqTy;
 
 static int ConstEqIndex = 0;
@@ -34,12 +34,13 @@
 namespace clang {
 namespace ento {
 template<>
-struct GRStateTrait<ConstNotEq> : public GRStatePartialTrait<ConstNotEqTy> {
+struct ProgramStateTrait<ConstNotEq> :
+  public ProgramStatePartialTrait<ConstNotEqTy> {
   static inline void *GDMIndex() { return &ConstNotEqIndex; }
 };
 
 template<>
-struct GRStateTrait<ConstEq> : public GRStatePartialTrait<ConstEqTy> {
+struct ProgramStateTrait<ConstEq> : public ProgramStatePartialTrait<ConstEqTy> {
   static inline void *GDMIndex() { return &ConstEqIndex; }
 };
 }
@@ -50,62 +51,81 @@
 // constants and integer variables.
 class BasicConstraintManager
   : public SimpleConstraintManager {
-  GRState::IntSetTy::Factory ISetFactory;
+  ProgramState::IntSetTy::Factory ISetFactory;
 public:
-  BasicConstraintManager(GRStateManager &statemgr, SubEngine &subengine)
+  BasicConstraintManager(ProgramStateManager &statemgr, SubEngine &subengine)
     : SimpleConstraintManager(subengine), 
       ISetFactory(statemgr.getAllocator()) {}
 
-  const GRState *assumeSymNE(const GRState *state, SymbolRef sym,
-                             const llvm::APSInt& V,
-                             const llvm::APSInt& Adjustment);
+  const ProgramState *assumeSymNE(const ProgramState *state,
+                                  SymbolRef sym,
+                                  const llvm::APSInt& V,
+                                  const llvm::APSInt& Adjustment);
 
-  const GRState *assumeSymEQ(const GRState *state, SymbolRef sym,
-                             const llvm::APSInt& V,
-                             const llvm::APSInt& Adjustment);
+  const ProgramState *assumeSymEQ(const ProgramState *state,
+                                  SymbolRef sym,
+                                  const llvm::APSInt& V,
+                                  const llvm::APSInt& Adjustment);
 
-  const GRState *assumeSymLT(const GRState *state, SymbolRef sym,
-                             const llvm::APSInt& V,
-                             const llvm::APSInt& Adjustment);
+  const ProgramState *assumeSymLT(const ProgramState *state,
+                                  SymbolRef sym,
+                                  const llvm::APSInt& V,
+                                  const llvm::APSInt& Adjustment);
 
-  const GRState *assumeSymGT(const GRState *state, SymbolRef sym,
-                             const llvm::APSInt& V,
-                             const llvm::APSInt& Adjustment);
+  const ProgramState *assumeSymGT(const ProgramState *state,
+                                  SymbolRef sym,
+                                  const llvm::APSInt& V,
+                                  const llvm::APSInt& Adjustment);
 
-  const GRState *assumeSymGE(const GRState *state, SymbolRef sym,
-                             const llvm::APSInt& V,
-                             const llvm::APSInt& Adjustment);
+  const ProgramState *assumeSymGE(const ProgramState *state,
+                                  SymbolRef sym,
+                                  const llvm::APSInt& V,
+                                  const llvm::APSInt& Adjustment);
 
-  const GRState *assumeSymLE(const GRState *state, SymbolRef sym,
-                             const llvm::APSInt& V,
-                             const llvm::APSInt& Adjustment);
+  const ProgramState *assumeSymLE(const ProgramState *state,
+                                  SymbolRef sym,
+                                  const llvm::APSInt& V,
+                                  const llvm::APSInt& Adjustment);
 
-  const GRState *AddEQ(const GRState *state, SymbolRef sym, const llvm::APSInt& V);
+  const ProgramState *AddEQ(const ProgramState *state,
+                            SymbolRef sym,
+                            const llvm::APSInt& V);
 
-  const GRState *AddNE(const GRState *state, SymbolRef sym, const llvm::APSInt& V);
+  const ProgramState *AddNE(const ProgramState *state,
+                            SymbolRef sym,
+                            const llvm::APSInt& V);
 
-  const llvm::APSInt* getSymVal(const GRState *state, SymbolRef sym) const;
-  bool isNotEqual(const GRState *state, SymbolRef sym, const llvm::APSInt& V)
-      const;
-  bool isEqual(const GRState *state, SymbolRef sym, const llvm::APSInt& V)
-      const;
+  const llvm::APSInt* getSymVal(const ProgramState *state,
+                                SymbolRef sym) const;
 
-  const GRState *removeDeadBindings(const GRState *state, SymbolReaper& SymReaper);
+  bool isNotEqual(const ProgramState *state,
+                  SymbolRef sym,
+                  const llvm::APSInt& V) const;
 
-  void print(const GRState *state, raw_ostream &Out,
-             const char* nl, const char *sep);
+  bool isEqual(const ProgramState *state,
+               SymbolRef sym,
+               const llvm::APSInt& V) const;
+
+  const ProgramState *removeDeadBindings(const ProgramState *state,
+                                         SymbolReaper& SymReaper);
+
+  void print(const ProgramState *state,
+             raw_ostream &Out,
+             const char* nl,
+             const char *sep);
 };
 
 } // end anonymous namespace
 
-ConstraintManager* ento::CreateBasicConstraintManager(GRStateManager& statemgr,
-                                                       SubEngine &subengine) {
+ConstraintManager*
+ento::CreateBasicConstraintManager(ProgramStateManager& statemgr,
+                                   SubEngine &subengine) {
   return new BasicConstraintManager(statemgr, subengine);
 }
 
-
-const GRState*
-BasicConstraintManager::assumeSymNE(const GRState *state, SymbolRef sym,
+const ProgramState*
+BasicConstraintManager::assumeSymNE(const ProgramState *state,
+                                    SymbolRef sym,
                                     const llvm::APSInt &V,
                                     const llvm::APSInt &Adjustment) {
   // First, determine if sym == X, where X+Adjustment != V.
@@ -124,8 +144,9 @@
   return AddNE(state, sym, Adjusted);
 }
 
-const GRState*
-BasicConstraintManager::assumeSymEQ(const GRState *state, SymbolRef sym,
+const ProgramState*
+BasicConstraintManager::assumeSymEQ(const ProgramState *state,
+                                    SymbolRef sym,
                                     const llvm::APSInt &V,
                                     const llvm::APSInt &Adjustment) {
   // First, determine if sym == X, where X+Adjustment != V.
@@ -145,8 +166,9 @@
 }
 
 // The logic for these will be handled in another ConstraintManager.
-const GRState*
-BasicConstraintManager::assumeSymLT(const GRState *state, SymbolRef sym,
+const ProgramState*
+BasicConstraintManager::assumeSymLT(const ProgramState *state,
+                                    SymbolRef sym,
                                     const llvm::APSInt &V,
                                     const llvm::APSInt &Adjustment) {
   // Is 'V' the smallest possible value?
@@ -159,8 +181,9 @@
   return assumeSymNE(state, sym, V, Adjustment);
 }
 
-const GRState*
-BasicConstraintManager::assumeSymGT(const GRState *state, SymbolRef sym,
+const ProgramState*
+BasicConstraintManager::assumeSymGT(const ProgramState *state,
+                                    SymbolRef sym,
                                     const llvm::APSInt &V,
                                     const llvm::APSInt &Adjustment) {
   // Is 'V' the largest possible value?
@@ -173,8 +196,9 @@
   return assumeSymNE(state, sym, V, Adjustment);
 }
 
-const GRState*
-BasicConstraintManager::assumeSymGE(const GRState *state, SymbolRef sym,
+const ProgramState*
+BasicConstraintManager::assumeSymGE(const ProgramState *state,
+                                    SymbolRef sym,
                                     const llvm::APSInt &V,
                                     const llvm::APSInt &Adjustment) {
   // Reject a path if the value of sym is a constant X and !(X+Adj >= V).
@@ -201,8 +225,9 @@
   return state;
 }
 
-const GRState*
-BasicConstraintManager::assumeSymLE(const GRState *state, SymbolRef sym,
+const ProgramState*
+BasicConstraintManager::assumeSymLE(const ProgramState *state,
+                                    SymbolRef sym,
                                     const llvm::APSInt &V,
                                     const llvm::APSInt &Adjustment) {
   // Reject a path if the value of sym is a constant X and !(X+Adj <= V).
@@ -229,18 +254,20 @@
   return state;
 }
 
-const GRState *BasicConstraintManager::AddEQ(const GRState *state, SymbolRef sym,
+const ProgramState *BasicConstraintManager::AddEQ(const ProgramState *state,
+                                                  SymbolRef sym,
                                              const llvm::APSInt& V) {
   // Create a new state with the old binding replaced.
   return state->set<ConstEq>(sym, &state->getBasicVals().getValue(V));
 }
 
-const GRState *BasicConstraintManager::AddNE(const GRState *state, SymbolRef sym,
-                                             const llvm::APSInt& V) {
+const ProgramState *BasicConstraintManager::AddNE(const ProgramState *state,
+                                                  SymbolRef sym,
+                                                  const llvm::APSInt& V) {
 
   // First, retrieve the NE-set associated with the given symbol.
   ConstNotEqTy::data_type* T = state->get<ConstNotEq>(sym);
-  GRState::IntSetTy S = T ? *T : ISetFactory.getEmptySet();
+  ProgramState::IntSetTy S = T ? *T : ISetFactory.getEmptySet();
 
   // Now add V to the NE set.
   S = ISetFactory.add(S, &state->getBasicVals().getValue(V));
@@ -249,13 +276,14 @@
   return state->set<ConstNotEq>(sym, S);
 }
 
-const llvm::APSInt* BasicConstraintManager::getSymVal(const GRState *state,
+const llvm::APSInt* BasicConstraintManager::getSymVal(const ProgramState *state,
                                                       SymbolRef sym) const {
   const ConstEqTy::data_type* T = state->get<ConstEq>(sym);
   return T ? *T : NULL;
 }
 
-bool BasicConstraintManager::isNotEqual(const GRState *state, SymbolRef sym,
+bool BasicConstraintManager::isNotEqual(const ProgramState *state,
+                                        SymbolRef sym,
                                         const llvm::APSInt& V) const {
 
   // Retrieve the NE-set associated with the given symbol.
@@ -265,7 +293,8 @@
   return T ? T->contains(&state->getBasicVals().getValue(V)) : false;
 }
 
-bool BasicConstraintManager::isEqual(const GRState *state, SymbolRef sym,
+bool BasicConstraintManager::isEqual(const ProgramState *state,
+                                     SymbolRef sym,
                                      const llvm::APSInt& V) const {
   // Retrieve the EQ-set associated with the given symbol.
   const ConstEqTy::data_type* T = state->get<ConstEq>(sym);
@@ -275,8 +304,8 @@
 
 /// Scan all symbols referenced by the constraints. If the symbol is not alive
 /// as marked in LSymbols, mark it as dead in DSymbols.
-const GRState*
-BasicConstraintManager::removeDeadBindings(const GRState *state,
+const ProgramState*
+BasicConstraintManager::removeDeadBindings(const ProgramState *state,
                                            SymbolReaper& SymReaper) {
 
   ConstEqTy CE = state->get<ConstEq>();
@@ -301,7 +330,8 @@
   return state->set<ConstNotEq>(CNE);
 }
 
-void BasicConstraintManager::print(const GRState *state, raw_ostream &Out,
+void BasicConstraintManager::print(const ProgramState *state,
+                                   raw_ostream &Out,
                                    const char* nl, const char *sep) {
   // Print equality constraints.
 
@@ -324,7 +354,7 @@
       Out << nl << " $" << I.getKey() << " : ";
       bool isFirst = true;
 
-      GRState::IntSetTy::iterator J = I.getData().begin(),
+      ProgramState::IntSetTy::iterator J = I.getData().begin(),
                                   EJ = I.getData().end();
 
       for ( ; J != EJ; ++J) {
diff --git a/lib/StaticAnalyzer/Core/BugReporter.cpp b/lib/StaticAnalyzer/Core/BugReporter.cpp
index 67a5e48..943d9fc 100644
--- a/lib/StaticAnalyzer/Core/BugReporter.cpp
+++ b/lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -346,9 +346,9 @@
 // ScanNotableSymbols: closure-like callback for scanning Store bindings.
 //===----------------------------------------------------------------------===//
 
-static const VarDecl*
-GetMostRecentVarDeclBinding(const ExplodedNode *N,
-                            GRStateManager& VMgr, SVal X) {
+static const VarDecl* GetMostRecentVarDeclBinding(const ExplodedNode *N,
+                                                  ProgramStateManager& VMgr,
+                                                  SVal X) {
 
   for ( ; N ; N = N->pred_empty() ? 0 : *N->pred_begin()) {
 
@@ -383,19 +383,29 @@
 : public StoreManager::BindingsHandler {
 
   SymbolRef Sym;
-  const GRState *PrevSt;
+  const ProgramState *PrevSt;
   const Stmt *S;
-  GRStateManager& VMgr;
+  ProgramStateManager& VMgr;
   const ExplodedNode *Pred;
   PathDiagnostic& PD;
   BugReporter& BR;
 
 public:
 
-  NotableSymbolHandler(SymbolRef sym, const GRState *prevst, const Stmt *s,
-                       GRStateManager& vmgr, const ExplodedNode *pred,
-                       PathDiagnostic& pd, BugReporter& br)
-  : Sym(sym), PrevSt(prevst), S(s), VMgr(vmgr), Pred(pred), PD(pd), BR(br) {}
+  NotableSymbolHandler(SymbolRef sym,
+                       const ProgramState *prevst,
+                       const Stmt *s,
+                       ProgramStateManager& vmgr,
+                       const ExplodedNode *pred,
+                       PathDiagnostic& pd,
+                       BugReporter& br)
+  : Sym(sym),
+    PrevSt(prevst),
+    S(s),
+    VMgr(vmgr),
+    Pred(pred),
+    PD(pd),
+    BR(br) {}
 
   bool HandleBinding(StoreManager& SMgr, Store store, const MemRegion* R,
                      SVal V) {
@@ -466,14 +476,14 @@
                                 PathDiagnostic& PD) {
 
   const ExplodedNode *Pred = N->pred_empty() ? 0 : *N->pred_begin();
-  const GRState *PrevSt = Pred ? Pred->getState() : 0;
+  const ProgramState *PrevSt = Pred ? Pred->getState() : 0;
 
   if (!PrevSt)
     return;
 
   // Look at the region bindings of the current state that map to the
   // specified symbol.  Are any of them not in the previous state?
-  GRStateManager& VMgr = cast<GRBugReporter>(BR).getStateManager();
+  ProgramStateManager& VMgr = cast<GRBugReporter>(BR).getStateManager();
   NotableSymbolHandler H(Sym, PrevSt, S, VMgr, Pred, PD, BR);
   cast<GRBugReporter>(BR).getStateManager().iterBindings(N->getState(), H);
 }
@@ -1314,7 +1324,7 @@
 
 ExplodedGraph &GRBugReporter::getGraph() { return Eng.getGraph(); }
 
-GRStateManager&
+ProgramStateManager&
 GRBugReporter::getStateManager() { return Eng.getStateManager(); }
 
 BugReporter::~BugReporter() { FlushReports(); }
diff --git a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
index e8500e3..143e633 100644
--- a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -17,7 +17,7 @@
 #include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/GRState.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
 
 using namespace clang;
 using namespace ento;
@@ -311,7 +311,7 @@
   if (!S)
     return;
 
-  GRStateManager &StateMgr = BRC.getStateManager();
+  ProgramStateManager &StateMgr = BRC.getStateManager();
   
   // Walk through nodes until we get one that matches the statement
   // exactly.
@@ -327,7 +327,7 @@
   if (!N)
     return;
   
-  const GRState *state = N->getState();
+  const ProgramState *state = N->getState();
 
   // Walk through lvalue-to-rvalue conversions.  
   if (const DeclRefExpr *DR = dyn_cast<DeclRefExpr>(S)) {
@@ -374,7 +374,7 @@
   if (!R)
     return;
 
-  const GRState *state = N->getState();
+  const ProgramState *state = N->getState();
   SVal V = state->getSVal(R);
 
   if (V.isUnknown())
@@ -407,7 +407,7 @@
     const Expr *Receiver = ME->getInstanceReceiver();
     if (!Receiver)
       return 0;
-    const GRState *state = N->getState();
+    const ProgramState *state = N->getState();
     const SVal &V = state->getSVal(Receiver);
     const DefinedOrUnknownSVal *DV = dyn_cast<DefinedOrUnknownSVal>(&V);
     if (!DV)
@@ -446,8 +446,8 @@
     const Stmt *Head = WorkList.front();
     WorkList.pop_front();
 
-    GRStateManager &StateMgr = BRC.getStateManager();
-    const GRState *state = N->getState();
+    ProgramStateManager &StateMgr = BRC.getStateManager();
+    const ProgramState *state = N->getState();
 
     if (const DeclRefExpr *DR = dyn_cast<DeclRefExpr>(Head)) {
       if (const VarDecl *VD = dyn_cast<VarDecl>(DR->getDecl())) {
@@ -486,8 +486,8 @@
                                          BugReporterContext &BRC);
   
   PathDiagnosticPiece *VisitTerminator(const Stmt *Term,
-                                       const GRState *CurrentState,
-                                       const GRState *PrevState,
+                                       const ProgramState *CurrentState,
+                                       const ProgramState *PrevState,
                                        const CFGBlock *srcBlk,
                                        const CFGBlock *dstBlk,
                                        BugReporterContext &BRC);
@@ -516,8 +516,8 @@
     const CFGBlock *srcBlk = BE->getSrc();
     
     if (const Stmt *term = srcBlk->getTerminator()) {
-      const GRState *CurrentState = N->getState();
-      const GRState *PrevState = Prev->getState();
+      const ProgramState *CurrentState = N->getState();
+      const ProgramState *PrevState = Prev->getState();
       if (CurrentState != PrevState)
         return VisitTerminator(term, CurrentState, PrevState,
                                srcBlk, BE->getDst(),
@@ -532,8 +532,8 @@
 
 PathDiagnosticPiece *
 ConditionVisitor::VisitTerminator(const Stmt *Term,
-                                  const GRState *CurrentState,
-                                  const GRState *PrevState,
+                                  const ProgramState *CurrentState,
+                                  const ProgramState *PrevState,
                                   const CFGBlock *srcBlk,
                                   const CFGBlock *dstBlk,
                                   BugReporterContext &BRC) {
diff --git a/lib/StaticAnalyzer/Core/CFRefCount.cpp b/lib/StaticAnalyzer/Core/CFRefCount.cpp
index 3b08fb7..da3a818 100644
--- a/lib/StaticAnalyzer/Core/CFRefCount.cpp
+++ b/lib/StaticAnalyzer/Core/CFRefCount.cpp
@@ -25,7 +25,7 @@
 #include "clang/StaticAnalyzer/Checkers/LocalCheckers.h"
 #include "clang/Analysis/DomainSpecific/CocoaConventions.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngineBuilders.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/GRStateTrait.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/TransferFuncs.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h"
 #include "llvm/ADT/DenseMap.h"
@@ -56,7 +56,7 @@
     return isValid();
   }
 
-  SVal getSValAsScalarOrLoc(const GRState *state) {
+  SVal getSValAsScalarOrLoc(const ProgramState *state) {
     assert(isValid());
     // We have an expression for the receiver?  Fetch the value
     // of that expression.
@@ -98,7 +98,7 @@
   GenericNodeBuilderRefCount(EndOfFunctionNodeBuilder &enb)
   : SNB(0), S(0), tag(0), ENB(&enb) {}
 
-  ExplodedNode *MakeNode(const GRState *state, ExplodedNode *Pred) {
+  ExplodedNode *MakeNode(const ProgramState *state, ExplodedNode *Pred) {
     if (SNB)
       return SNB->generateNode(PostStmt(S, Pred->getLocationContext(), tag),
                                state, Pred);
@@ -396,13 +396,14 @@
 
 namespace clang {
 namespace ento {
-  template<>
-  struct GRStateTrait<RefBindings> : public GRStatePartialTrait<RefBindings> {
-    static void *GDMIndex() {
-      static int RefBIndex = 0;
-      return &RefBIndex;
-    }
-  };
+template<>
+struct ProgramStateTrait<RefBindings>
+  : public ProgramStatePartialTrait<RefBindings> {
+  static void *GDMIndex() {
+    static int RefBIndex = 0;
+    return &RefBIndex;
+  }
+};
 }
 }
 
@@ -814,7 +815,7 @@
   RetainSummary* getSummary(const FunctionDecl *FD);
 
   RetainSummary *getInstanceMethodSummary(const ObjCMessage &msg,
-                                          const GRState *state,
+                                          const ProgramState *state,
                                           const LocationContext *LC);
 
   RetainSummary* getInstanceMethodSummary(const ObjCMessage &msg,
@@ -1358,7 +1359,7 @@
 
 RetainSummary*
 RetainSummaryManager::getInstanceMethodSummary(const ObjCMessage &msg,
-                                               const GRState *state,
+                                               const ProgramState *state,
                                                const LocationContext *LC) {
 
   // We need the type-information of the tracked receiver object
@@ -1609,26 +1610,27 @@
 
 namespace clang {
 namespace ento {
-template<> struct GRStateTrait<AutoreleaseStack>
-  : public GRStatePartialTrait<ARStack> {
+template<> struct ProgramStateTrait<AutoreleaseStack>
+  : public ProgramStatePartialTrait<ARStack> {
   static inline void *GDMIndex() { return &AutoRBIndex; }
 };
 
-template<> struct GRStateTrait<AutoreleasePoolContents>
-  : public GRStatePartialTrait<ARPoolContents> {
+template<> struct ProgramStateTrait<AutoreleasePoolContents>
+  : public ProgramStatePartialTrait<ARPoolContents> {
   static inline void *GDMIndex() { return &AutoRCIndex; }
 };
 } // end GR namespace
 } // end clang namespace
 
-static SymbolRef GetCurrentAutoreleasePool(const GRState *state) {
+static SymbolRef GetCurrentAutoreleasePool(const ProgramState *state) {
   ARStack stack = state->get<AutoreleaseStack>();
   return stack.isEmpty() ? SymbolRef() : stack.getHead();
 }
 
-static const GRState * SendAutorelease(const GRState *state,
-                                       ARCounts::Factory &F, SymbolRef sym) {
-
+static const ProgramState *
+SendAutorelease(const ProgramState *state,
+                ARCounts::Factory &F,
+                SymbolRef sym) {
   SymbolRef pool = GetCurrentAutoreleasePool(state);
   const ARCounts *cnts = state->get<AutoreleasePoolContents>(pool);
   ARCounts newCnts(0);
@@ -1651,10 +1653,12 @@
 
 class CFRefCount : public TransferFuncs {
 public:
-  class BindingsPrinter : public GRState::Printer {
+  class BindingsPrinter : public ProgramState::Printer {
   public:
-    virtual void Print(raw_ostream &Out, const GRState *state,
-                       const char* nl, const char* sep);
+    virtual void Print(raw_ostream &Out,
+                       const ProgramState *state,
+                       const char* nl,
+                       const char* sep);
   };
 
   typedef llvm::DenseMap<const ExplodedNode*, const RetainSummary*>
@@ -1674,24 +1678,31 @@
   
   llvm::DenseMap<SymbolRef, const SimpleProgramPointTag*> DeadSymbolTags;
 
-  const GRState * Update(const GRState * state, SymbolRef sym, RefVal V,
-                         ArgEffect E, RefVal::Kind& hasErr);
+  const ProgramState *Update(const ProgramState * state,
+                             SymbolRef sym,
+                             RefVal V,
+                             ArgEffect E,
+                             RefVal::Kind& hasErr);
 
   void ProcessNonLeakError(ExplodedNodeSet &Dst,
                            StmtNodeBuilder& Builder,
-                           const Expr *NodeExpr, SourceRange ErrorRange,
+                           const Expr *NodeExpr,
+                           SourceRange ErrorRange,
                            ExplodedNode *Pred,
-                           const GRState *St,
-                           RefVal::Kind hasErr, SymbolRef Sym);
+                           const ProgramState *St,
+                           RefVal::Kind hasErr,
+                           SymbolRef Sym);
 
-  const GRState * HandleSymbolDeath(const GRState * state, SymbolRef sid, RefVal V,
-                               SmallVectorImpl<SymbolRef> &Leaked);
+  const ProgramState *HandleSymbolDeath(const ProgramState * state,
+                                        SymbolRef sid,
+                                        RefVal V,
+                                        SmallVectorImpl<SymbolRef> &Leaked);
 
-  ExplodedNode *ProcessLeaks(const GRState * state,
-                                      SmallVectorImpl<SymbolRef> &Leaked,
-                                      GenericNodeBuilderRefCount &Builder,
-                                      ExprEngine &Eng,
-                                      ExplodedNode *Pred = 0);
+  ExplodedNode *ProcessLeaks(const ProgramState * state,
+                             SmallVectorImpl<SymbolRef> &Leaked,
+                             GenericNodeBuilderRefCount &Builder,
+                             ExprEngine &Eng,
+                             ExplodedNode *Pred = 0);
 
 public:
   CFRefCount(ASTContext &Ctx, bool gcenabled, const LangOptions& lopts)
@@ -1709,7 +1720,7 @@
 
   void RegisterChecks(ExprEngine &Eng);
 
-  virtual void RegisterPrinters(std::vector<GRState::Printer*>& Printers) {
+  virtual void RegisterPrinters(std::vector<ProgramState::Printer*>& Printers) {
     Printers.push_back(new BindingsPrinter());
   }
 
@@ -1733,7 +1744,7 @@
                    InstanceReceiver Receiver,
                    const RetainSummary& Summ,
                    const MemRegion *Callee,
-                   ExplodedNode *Pred, const GRState *state);
+                   ExplodedNode *Pred, const ProgramState *state);
 
   virtual void evalCall(ExplodedNodeSet &Dst,
                         ExprEngine& Eng,
@@ -1747,7 +1758,7 @@
                                StmtNodeBuilder& Builder,
                                ObjCMessage msg,
                                ExplodedNode *Pred,
-                               const GRState *state);
+                               const ProgramState *state);
   // Stores.
   virtual void evalBind(StmtNodeBuilderRef& B, SVal location, SVal val);
 
@@ -1760,15 +1771,19 @@
                                ExprEngine& Engine,
                                StmtNodeBuilder& Builder,
                                ExplodedNode *Pred,
-                               const GRState *state,
+                               const ProgramState *state,
                                SymbolReaper& SymReaper);
 
   const ProgramPointTag *getDeadSymbolTag(SymbolRef sym);
   
-  std::pair<ExplodedNode*, const GRState *>
-  HandleAutoreleaseCounts(const GRState * state, GenericNodeBuilderRefCount Bd,
-                          ExplodedNode *Pred, ExprEngine &Eng,
-                          SymbolRef Sym, RefVal V, bool &stop);
+  std::pair<ExplodedNode*, const ProgramState *>
+  HandleAutoreleaseCounts(const ProgramState * state,
+                          GenericNodeBuilderRefCount Bd,
+                          ExplodedNode *Pred,
+                          ExprEngine &Eng,
+                          SymbolRef Sym,
+                          RefVal V,
+                          bool &stop);
   // Return statements.
 
   virtual void evalReturn(ExplodedNodeSet &Dst,
@@ -1783,19 +1798,21 @@
                                const ReturnStmt *S,
                                ExplodedNode *Pred,
                                RetEffect RE, RefVal X,
-                               SymbolRef Sym, const GRState *state);
+                               SymbolRef Sym, const ProgramState *state);
 
 
   // Assumptions.
 
-  virtual const GRState *evalAssume(const GRState *state, SVal condition,
-                                    bool assumption);
+  virtual const ProgramState *evalAssume(const ProgramState *state,
+                                         SVal condition,
+                                         bool assumption);
 };
 
 } // end anonymous namespace
 
-static void PrintPool(raw_ostream &Out, SymbolRef Sym,
-                      const GRState *state) {
+static void PrintPool(raw_ostream &Out,
+                      SymbolRef Sym,
+                      const ProgramState *state) {
   Out << ' ';
   if (Sym)
     Out << Sym->getSymbolID();
@@ -1812,7 +1829,7 @@
 }
 
 void CFRefCount::BindingsPrinter::Print(raw_ostream &Out,
-                                        const GRState *state,
+                                        const ProgramState *state,
                                         const char* nl, const char* sep) {
 
   RefBindings B = state->get<RefBindings>();
@@ -2060,8 +2077,8 @@
     return NULL;
 
   // Check if the type state has changed.
-  const GRState *PrevSt = PrevN->getState();
-  const GRState *CurrSt = N->getState();
+  const ProgramState *PrevSt = PrevN->getState();
+  const ProgramState *CurrSt = N->getState();
 
   const RefVal* CurrT = CurrSt->get<RefBindings>(Sym);
   if (!CurrT) return NULL;
@@ -2329,7 +2346,7 @@
 }
 
 static std::pair<const ExplodedNode*,const MemRegion*>
-GetAllocationSite(GRStateManager& StateMgr, const ExplodedNode *N,
+GetAllocationSite(ProgramStateManager& StateMgr, const ExplodedNode *N,
                   SymbolRef Sym) {
 
   // Find both first node that referred to the tracked symbol and the
@@ -2338,7 +2355,7 @@
   const MemRegion* FirstBinding = 0;
 
   while (N) {
-    const GRState *St = N->getState();
+    const ProgramState *St = N->getState();
     RefBindings B = St->get<RefBindings>();
 
     if (!B.lookup(Sym))
@@ -2555,7 +2572,8 @@
                              InstanceReceiver Receiver,
                              const RetainSummary& Summ,
                              const MemRegion *Callee,
-                             ExplodedNode *Pred, const GRState *state) {
+                             ExplodedNode *Pred,
+                             const ProgramState *state) {
 
   // Evaluate the effect of the arguments.
   RefVal::Kind hasErr = (RefVal::Kind) 0;
@@ -2850,7 +2868,7 @@
                                  StmtNodeBuilder& Builder,
                                  ObjCMessage msg,
                                  ExplodedNode *Pred,
-                                 const GRState *state) {
+                                 const ProgramState *state) {
   RetainSummary *Summ =
     msg.isInstanceMessage()
       ? Summaries.getInstanceMethodSummary(msg, state,Pred->getLocationContext())
@@ -2865,10 +2883,10 @@
 
 namespace {
 class StopTrackingCallback : public SymbolVisitor {
-  const GRState *state;
+  const ProgramState *state;
 public:
-  StopTrackingCallback(const GRState *st) : state(st) {}
-  const GRState *getState() const { return state; }
+  StopTrackingCallback(const ProgramState *st) : state(st) {}
+  const ProgramState *getState() const { return state; }
 
   bool VisitSymbol(SymbolRef sym) {
     state = state->remove<RefBindings>(sym);
@@ -2888,7 +2906,7 @@
   // (2) we are binding to a memregion that does not have stack storage
   // (3) we are binding to a memregion with stack storage that the store
   //     does not understand.
-  const GRState *state = B.getState();
+  const ProgramState *state = B.getState();
 
   if (!isa<loc::MemRegionVal>(location))
     escapes = true;
@@ -2927,7 +2945,7 @@
   if (!RetE)
     return;
 
-  const GRState *state = Pred->getState();
+  const ProgramState *state = Pred->getState();
   SymbolRef Sym = state->getSValAsScalarOrLoc(RetE).getAsLocSymbol();
 
   if (!Sym)
@@ -3016,7 +3034,8 @@
                                          const ReturnStmt *S,
                                          ExplodedNode *Pred,
                                          RetEffect RE, RefVal X,
-                                         SymbolRef Sym, const GRState *state) {
+                                         SymbolRef Sym,
+                                         const ProgramState *state) {
   // Any leaks or other errors?
   if (X.isReturnedOwned() && X.getCount() == 0) {
     if (RE.getKind() != RetEffect::NoRet) {
@@ -3078,8 +3097,9 @@
 
 // Assumptions.
 
-const GRState *CFRefCount::evalAssume(const GRState *state,
-                                      SVal Cond, bool Assumption) {
+const ProgramState *CFRefCount::evalAssume(const ProgramState *state,
+                                           SVal Cond,
+                                           bool Assumption) {
 
   // FIXME: We may add to the interface of evalAssume the list of symbols
   //  whose assumptions have changed.  For now we just iterate through the
@@ -3110,9 +3130,11 @@
   return state;
 }
 
-const GRState * CFRefCount::Update(const GRState * state, SymbolRef sym,
-                              RefVal V, ArgEffect E,
-                              RefVal::Kind& hasErr) {
+const ProgramState * CFRefCount::Update(const ProgramState * state,
+                                        SymbolRef sym,
+                                        RefVal V,
+                                        ArgEffect E,
+                                        RefVal::Kind& hasErr) {
 
   // In GC mode [... release] and [... retain] do nothing.
   switch (E) {
@@ -3250,12 +3272,14 @@
 // Handle dead symbols and end-of-path.
 //===----------------------------------------------------------------------===//
 
-std::pair<ExplodedNode*, const GRState *>
-CFRefCount::HandleAutoreleaseCounts(const GRState * state, 
+std::pair<ExplodedNode*, const ProgramState *>
+CFRefCount::HandleAutoreleaseCounts(const ProgramState *state, 
                                     GenericNodeBuilderRefCount Bd,
                                     ExplodedNode *Pred,
                                     ExprEngine &Eng,
-                                    SymbolRef Sym, RefVal V, bool &stop) {
+                                    SymbolRef Sym,
+                                    RefVal V,
+                                    bool &stop) {
 
   unsigned ACnt = V.getAutoreleaseCount();
   stop = false;
@@ -3315,8 +3339,10 @@
   return std::make_pair((ExplodedNode*)0, state);
 }
 
-const GRState *
-CFRefCount::HandleSymbolDeath(const GRState * state, SymbolRef sid, RefVal V,
+const ProgramState *
+CFRefCount::HandleSymbolDeath(const ProgramState *state,
+                              SymbolRef sid,
+                              RefVal V,
                               SmallVectorImpl<SymbolRef> &Leaked) {
 
   bool hasLeak = V.isOwned() ||
@@ -3330,7 +3356,7 @@
 }
 
 ExplodedNode*
-CFRefCount::ProcessLeaks(const GRState * state,
+CFRefCount::ProcessLeaks(const ProgramState * state,
                          SmallVectorImpl<SymbolRef> &Leaked,
                          GenericNodeBuilderRefCount &Builder,
                          ExprEngine& Eng,
@@ -3360,7 +3386,7 @@
 void CFRefCount::evalEndPath(ExprEngine& Eng,
                              EndOfFunctionNodeBuilder& Builder) {
 
-  const GRState *state = Builder.getState();
+  const ProgramState *state = Builder.getState();
   GenericNodeBuilderRefCount Bd(Builder);
   RefBindings B = state->get<RefBindings>();
   ExplodedNode *Pred = 0;
@@ -3399,7 +3425,7 @@
                                  ExprEngine& Eng,
                                  StmtNodeBuilder& Builder,
                                  ExplodedNode *Pred,
-                                 const GRState *state,
+                                 const ProgramState *state,
                                  SymbolReaper& SymReaper) {
   const Stmt *S = Builder.getStmt();
   RefBindings B = state->get<RefBindings>();
@@ -3454,7 +3480,7 @@
                                      const Expr *NodeExpr, 
                                      SourceRange ErrorRange,
                                      ExplodedNode *Pred,
-                                     const GRState *St,
+                                     const ProgramState *St,
                                      RefVal::Kind hasErr, SymbolRef Sym) {
   Builder.BuildSinks = true;
   ExplodedNode *N  = Builder.MakeNode(Dst, NodeExpr, Pred, St);
@@ -3508,19 +3534,19 @@
                       
     void checkPostStmt(const CastExpr *CE, CheckerContext &C) const;
 
-    const GRState *checkRegionChanges(const GRState *state,
+    const ProgramState *checkRegionChanges(const ProgramState *state,
                             const StoreManager::InvalidatedSymbols *invalidated,
                                       const MemRegion * const *begin,
                                       const MemRegion * const *end) const;
                                           
-    bool wantsRegionChangeUpdate(const GRState *state) const {
+    bool wantsRegionChangeUpdate(const ProgramState *state) const {
       return wantsRegionUpdate;
     }
 };
 } // end anonymous namespace
 
-const GRState *
-RetainReleaseChecker::checkRegionChanges(const GRState *state,
+const ProgramState *
+RetainReleaseChecker::checkRegionChanges(const ProgramState *state,
                             const StoreManager::InvalidatedSymbols *invalidated,
                                          const MemRegion * const *begin,
                                          const MemRegion * const *end) const {
@@ -3546,7 +3572,7 @@
   if (!BE->getBlockDecl()->hasCaptures())
     return;
 
-  const GRState *state = C.getState();
+  const ProgramState *state = C.getState();
   const BlockDataRegion *R =
     cast<BlockDataRegion>(state->getSVal(BE).getAsRegion());
 
@@ -3597,7 +3623,7 @@
       break;
   }
   
-  const GRState *state = C.getState();
+  const ProgramState *state = C.getState();
   SymbolRef Sym = state->getSVal(CE).getAsLocSymbol();
   if (!Sym)
     return;
diff --git a/lib/StaticAnalyzer/Core/CMakeLists.txt b/lib/StaticAnalyzer/Core/CMakeLists.txt
index 8c5580f..7baf52d 100644
--- a/lib/StaticAnalyzer/Core/CMakeLists.txt
+++ b/lib/StaticAnalyzer/Core/CMakeLists.txt
@@ -20,12 +20,12 @@
   Environment.cpp
   ExplodedGraph.cpp
   ExprEngine.cpp
-  GRState.cpp
   HTMLDiagnostics.cpp
   MemRegion.cpp
   ObjCMessage.cpp
   PathDiagnostic.cpp
   PlistDiagnostics.cpp
+  ProgramState.cpp
   RangeConstraintManager.cpp
   RegionStore.cpp
   SValBuilder.cpp
diff --git a/lib/StaticAnalyzer/Core/CXXExprEngine.cpp b/lib/StaticAnalyzer/Core/CXXExprEngine.cpp
index caf7221..4a90f77 100644
--- a/lib/StaticAnalyzer/Core/CXXExprEngine.cpp
+++ b/lib/StaticAnalyzer/Core/CXXExprEngine.cpp
@@ -109,7 +109,7 @@
   ExplodedNodeSet Tmp;
   Visit(ME->GetTemporaryExpr(), Pred, Tmp);
   for (ExplodedNodeSet::iterator I = Tmp.begin(), E = Tmp.end(); I != E; ++I) {
-    const GRState *state = (*I)->getState();
+    const ProgramState *state = (*I)->getState();
 
     // Bind the temporary object to the value of the expression. Then bind
     // the expression to the location of the object.
@@ -187,7 +187,7 @@
 
     for (ExplodedNodeSet::iterator NI = argsEvaluated.begin(),
                                   NE = argsEvaluated.end(); NI != NE; ++NI) {
-      const GRState *state = (*NI)->getState();
+      const ProgramState *state = (*NI)->getState();
       // Setup 'this' region, so that the ctor is evaluated on the object pointed
       // by 'Dest'.
       state = state->bindLoc(loc::MemRegionVal(ThisR), loc::MemRegionVal(Dest));
@@ -216,7 +216,7 @@
        i != e; ++i)
   {
     ExplodedNode *Pred = *i;
-    const GRState *state = Pred->getState();
+    const ProgramState *state = Pred->getState();
 
     // Accumulate list of regions that are invalidated.
     for (CXXConstructExpr::const_arg_iterator
@@ -259,7 +259,7 @@
 
   CallEnter PP(S, SFC, Pred->getLocationContext());
 
-  const GRState *state = Pred->getState();
+  const ProgramState *state = Pred->getState();
   state = state->bindLoc(loc::MemRegionVal(ThisR), loc::MemRegionVal(Dest));
   ExplodedNode *N = Builder->generateNode(PP, state, Pred);
   if (N)
@@ -280,7 +280,7 @@
   if (CNE->isArray()) {
     // FIXME: allocating an array requires simulating the constructors.
     // For now, just return a symbolicated region.
-    const GRState *state = Pred->getState();
+    const ProgramState *state = Pred->getState();
     state = state->BindExpr(CNE, loc::MemRegionVal(EleReg));
     MakeNode(Dst, CNE, Pred, state);
     return;
@@ -299,7 +299,7 @@
   for (ExplodedNodeSet::iterator I = argsEvaluated.begin(), 
                                  E = argsEvaluated.end(); I != E; ++I) {
 
-    const GRState *state = (*I)->getState();
+    const ProgramState *state = (*I)->getState();
     
     // Accumulate list of regions that are invalidated.
     // FIXME: Eventually we should unify the logic for constructor
@@ -352,7 +352,7 @@
   Visit(CDE->getArgument(), Pred, Argevaluated);
   for (ExplodedNodeSet::iterator I = Argevaluated.begin(), 
                                  E = Argevaluated.end(); I != E; ++I) {
-    const GRState *state = (*I)->getState();
+    const ProgramState *state = (*I)->getState();
     MakeNode(Dst, CDE, *I, state);
   }
 }
@@ -365,7 +365,7 @@
                                   getContext().getCanonicalType(TE->getType()),
                                                Pred->getLocationContext());
 
-  const GRState *state = Pred->getState();
+  const ProgramState *state = Pred->getState();
   SVal V = state->getSVal(loc::MemRegionVal(R));
   MakeNode(Dst, TE, Pred, state->BindExpr(TE, V));
 }
diff --git a/lib/StaticAnalyzer/Core/CheckerManager.cpp b/lib/StaticAnalyzer/Core/CheckerManager.cpp
index a0840ff..729e4cb 100644
--- a/lib/StaticAnalyzer/Core/CheckerManager.cpp
+++ b/lib/StaticAnalyzer/Core/CheckerManager.cpp
@@ -294,7 +294,7 @@
 }
 
 /// \brief Run checkers for live symbols.
-void CheckerManager::runCheckersForLiveSymbols(const GRState *state,
+void CheckerManager::runCheckersForLiveSymbols(const ProgramState *state,
                                                SymbolReaper &SymReaper) {
   for (unsigned i = 0, e = LiveSymbolsCheckers.size(); i != e; ++i)
     LiveSymbolsCheckers[i](state, SymReaper);
@@ -335,7 +335,7 @@
 }
 
 /// \brief True if at least one checker wants to check region changes.
-bool CheckerManager::wantsRegionChangeUpdate(const GRState *state) {
+bool CheckerManager::wantsRegionChangeUpdate(const ProgramState *state) {
   for (unsigned i = 0, e = RegionChangesCheckers.size(); i != e; ++i)
     if (RegionChangesCheckers[i].WantUpdateFn(state))
       return true;
@@ -344,8 +344,8 @@
 }
 
 /// \brief Run checkers for region changes.
-const GRState *
-CheckerManager::runCheckersForRegionChanges(const GRState *state,
+const ProgramState *
+CheckerManager::runCheckersForRegionChanges(const ProgramState *state,
                             const StoreManager::InvalidatedSymbols *invalidated,
                                             const MemRegion * const *Begin,
                                             const MemRegion * const *End) {
@@ -360,8 +360,8 @@
 }
 
 /// \brief Run checkers for handling assumptions on symbolic values.
-const GRState *
-CheckerManager::runCheckersForEvalAssume(const GRState *state,
+const ProgramState *
+CheckerManager::runCheckersForEvalAssume(const ProgramState *state,
                                          SVal Cond, bool Assumption) {
   for (unsigned i = 0, e = EvalAssumeCheckers.size(); i != e; ++i) {
     // If any checker declares the state infeasible (or if it starts that way),
diff --git a/lib/StaticAnalyzer/Core/CoreEngine.cpp b/lib/StaticAnalyzer/Core/CoreEngine.cpp
index ea7b94c..f71802f 100644
--- a/lib/StaticAnalyzer/Core/CoreEngine.cpp
+++ b/lib/StaticAnalyzer/Core/CoreEngine.cpp
@@ -159,7 +159,7 @@
 
 /// ExecuteWorkList - Run the worklist algorithm for a maximum number of steps.
 bool CoreEngine::ExecuteWorkList(const LocationContext *L, unsigned Steps,
-                                   const GRState *InitState) {
+                                   const ProgramState *InitState) {
 
   if (G->num_roots() == 0) { // Initialize the analysis by constructing
     // the root if none exists.
@@ -243,9 +243,9 @@
 }
 
 void CoreEngine::ExecuteWorkListWithInitialState(const LocationContext *L, 
-                                                   unsigned Steps,
-                                                   const GRState *InitState, 
-                                                   ExplodedNodeSet &Dst) {
+                                                 unsigned Steps,
+                                                 const ProgramState *InitState, 
+                                                 ExplodedNodeSet &Dst) {
   ExecuteWorkList(L, Steps, InitState);
   for (SmallVectorImpl<ExplodedNode*>::iterator I = G->EndNodes.begin(), 
                                            E = G->EndNodes.end(); I != E; ++I) {
@@ -443,7 +443,8 @@
 /// generateNode - Utility method to generate nodes, hook up successors,
 ///  and add nodes to the worklist.
 void CoreEngine::generateNode(const ProgramPoint &Loc,
-                              const GRState *State, ExplodedNode *Pred) {
+                              const ProgramState *State,
+                              ExplodedNode *Pred) {
 
   bool IsNew;
   ExplodedNode *Node = G->getNode(Loc, State, &IsNew);
@@ -460,7 +461,7 @@
 }
 
 ExplodedNode *
-GenericNodeBuilderImpl::generateNodeImpl(const GRState *state,
+GenericNodeBuilderImpl::generateNodeImpl(const ProgramState *state,
                                          ExplodedNode *pred,
                                          ProgramPoint programPoint,
                                          bool asSink) {
@@ -480,9 +481,11 @@
   return 0;
 }
 
-StmtNodeBuilder::StmtNodeBuilder(const CFGBlock *b, unsigned idx,
-                                     ExplodedNode *N, CoreEngine* e,
-                                     GRStateManager &mgr)
+StmtNodeBuilder::StmtNodeBuilder(const CFGBlock *b,
+                                 unsigned idx,
+                                 ExplodedNode *N,
+                                 CoreEngine* e,
+                                 ProgramStateManager &mgr)
   : Eng(*e), B(*b), Idx(idx), Pred(N), Mgr(mgr),
     PurgingDeadSymbols(false), BuildSinks(false), hasGeneratedNode(false),
     PointKind(ProgramPoint::PostStmtKind), Tag(0) {
@@ -529,9 +532,11 @@
     Eng.WList->enqueue(Succ, &B, Idx+1);
 }
 
-ExplodedNode *StmtNodeBuilder::MakeNode(ExplodedNodeSet &Dst, const Stmt *S, 
-                                          ExplodedNode *Pred, const GRState *St,
-                                          ProgramPoint::Kind K) {
+ExplodedNode *StmtNodeBuilder::MakeNode(ExplodedNodeSet &Dst,
+                                        const Stmt *S, 
+                                        ExplodedNode *Pred,
+                                        const ProgramState *St,
+                                        ProgramPoint::Kind K) {
 
   ExplodedNode *N = generateNode(S, St, Pred, K);
 
@@ -571,7 +576,8 @@
 }
 
 ExplodedNode*
-StmtNodeBuilder::generateNodeInternal(const Stmt *S, const GRState *state,
+StmtNodeBuilder::generateNodeInternal(const Stmt *S,
+                                      const ProgramState *state,
                                       ExplodedNode *Pred,
                                       ProgramPoint::Kind K,
                                       const ProgramPointTag *tag) {
@@ -583,8 +589,8 @@
 
 ExplodedNode*
 StmtNodeBuilder::generateNodeInternal(const ProgramPoint &Loc,
-                                        const GRState *State,
-                                        ExplodedNode *Pred) {
+                                      const ProgramState *State,
+                                      ExplodedNode *Pred) {
   bool IsNew;
   ExplodedNode *N = Eng.G->getNode(Loc, State, &IsNew);
   N->addPredecessor(Pred, *Eng.G);
@@ -600,7 +606,7 @@
 
 // This function generate a new ExplodedNode but not a new branch(block edge).
 ExplodedNode *BranchNodeBuilder::generateNode(const Stmt *Condition,
-                                              const GRState *State) {
+                                              const ProgramState *State) {
   bool IsNew;
   
   ExplodedNode *Succ 
@@ -617,8 +623,8 @@
   return NULL;
 }
 
-ExplodedNode *BranchNodeBuilder::generateNode(const GRState *State,
-                                                bool branch) {
+ExplodedNode *BranchNodeBuilder::generateNode(const ProgramState *State,
+                                              bool branch) {
 
   // If the branch has been marked infeasible we should not generate a node.
   if (!isFeasible(branch))
@@ -655,8 +661,9 @@
 
 
 ExplodedNode*
-IndirectGotoNodeBuilder::generateNode(const iterator &I, const GRState *St,
-                                        bool isSink) {
+IndirectGotoNodeBuilder::generateNode(const iterator &I,
+                                      const ProgramState *St,
+                                      bool isSink) {
   bool IsNew;
 
   ExplodedNode *Succ = Eng.G->getNode(BlockEdge(Src, I.getBlock(),
@@ -679,26 +686,25 @@
 
 
 ExplodedNode*
-SwitchNodeBuilder::generateCaseStmtNode(const iterator &I, const GRState *St){
+SwitchNodeBuilder::generateCaseStmtNode(const iterator &I,
+                                        const ProgramState *St) {
 
   bool IsNew;
-
   ExplodedNode *Succ = Eng.G->getNode(BlockEdge(Src, I.getBlock(),
-                                       Pred->getLocationContext()), St, &IsNew);
+                                      Pred->getLocationContext()),
+                                      St, &IsNew);
   Succ->addPredecessor(Pred, *Eng.G);
-
   if (IsNew) {
     Eng.WList->enqueue(Succ);
     return Succ;
   }
-
   return NULL;
 }
 
 
 ExplodedNode*
-SwitchNodeBuilder::generateDefaultCaseNode(const GRState *St, bool isSink) {
-
+SwitchNodeBuilder::generateDefaultCaseNode(const ProgramState *St,
+                                           bool isSink) {
   // Get the block for the default case.
   assert (Src->succ_rbegin() != Src->succ_rend());
   CFGBlock *DefaultBlock = *Src->succ_rbegin();
@@ -733,7 +739,7 @@
 }
 
 ExplodedNode*
-EndOfFunctionNodeBuilder::generateNode(const GRState *State,
+EndOfFunctionNodeBuilder::generateNode(const ProgramState *State,
                                        ExplodedNode *P,
                                        const ProgramPointTag *tag) {
   hasGeneratedNode = true;
@@ -753,7 +759,7 @@
   return NULL;
 }
 
-void EndOfFunctionNodeBuilder::GenerateCallExitNode(const GRState *state) {
+void EndOfFunctionNodeBuilder::GenerateCallExitNode(const ProgramState *state) {
   hasGeneratedNode = true;
   // Create a CallExit node and enqueue it.
   const StackFrameContext *LocCtx
@@ -772,7 +778,7 @@
 }
                                                 
 
-void CallEnterNodeBuilder::generateNode(const GRState *state) {
+void CallEnterNodeBuilder::generateNode(const ProgramState *state) {
   // Check if the callee is in the same translation unit.
   if (CalleeCtx->getTranslationUnit() != 
       Pred->getLocationContext()->getTranslationUnit()) {
@@ -824,8 +830,8 @@
                                                OldLocCtx->getIndex());
 
     // Now create an initial state for the new engine.
-    const GRState *NewState = NewEng.getStateManager().MarshalState(state,
-                                                                    NewLocCtx);
+    const ProgramState *NewState =
+      NewEng.getStateManager().MarshalState(state, NewLocCtx);
     ExplodedNodeSet ReturnNodes;
     NewEng.ExecuteWorkListWithInitialState(NewLocCtx, AMgr.getMaxNodes(), 
                                            NewState, ReturnNodes);
@@ -851,7 +857,7 @@
     Eng.WList->enqueue(Node);
 }
 
-void CallExitNodeBuilder::generateNode(const GRState *state) {
+void CallExitNodeBuilder::generateNode(const ProgramState *state) {
   // Get the callee's location context.
   const StackFrameContext *LocCtx 
                          = cast<StackFrameContext>(Pred->getLocationContext());
diff --git a/lib/StaticAnalyzer/Core/Environment.cpp b/lib/StaticAnalyzer/Core/Environment.cpp
index 2572c12..2cc8bb0 100644
--- a/lib/StaticAnalyzer/Core/Environment.cpp
+++ b/lib/StaticAnalyzer/Core/Environment.cpp
@@ -13,7 +13,7 @@
 
 #include "clang/Analysis/AnalysisContext.h"
 #include "clang/Analysis/CFG.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/GRState.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
 
 using namespace clang;
 using namespace ento;
@@ -143,7 +143,7 @@
 Environment
 EnvironmentManager::removeDeadBindings(Environment Env,
                                        SymbolReaper &SymReaper,
-                                       const GRState *ST) {
+                                       const ProgramState *ST) {
 
   // We construct a new Environment object entirely, as this is cheaper than
   // individually removing all the subexpression bindings (which will greatly
diff --git a/lib/StaticAnalyzer/Core/ExplodedGraph.cpp b/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
index 503341e..d5ec07a 100644
--- a/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
+++ b/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
@@ -13,7 +13,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/GRState.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
 #include "clang/AST/Stmt.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/DenseMap.h"
@@ -103,8 +103,8 @@
       continue;
 
     // Conditions 5, 6, and 7.
-    const GRState *state = node->getState();
-    const GRState *pred_state = pred->getState();    
+    const ProgramState *state = node->getState();
+    const ProgramState *pred_state = pred->getState();    
     if (state->store != pred_state->store || state->GDM != pred_state->GDM ||
         progPoint.getLocationContext() != pred->getLocationContext())
       continue;
@@ -216,7 +216,7 @@
 }
 
 ExplodedNode *ExplodedGraph::getNode(const ProgramPoint &L,
-                                     const GRState *State, bool* IsNew) {
+                                     const ProgramState *State, bool* IsNew) {
   // Profile 'State' to determine if we already have an existing node.
   llvm::FoldingSetNodeID profile;
   void *InsertPos = 0;
diff --git a/lib/StaticAnalyzer/Core/ExprEngine.cpp b/lib/StaticAnalyzer/Core/ExprEngine.cpp
index 0e9544c..b54927e 100644
--- a/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ b/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -93,8 +93,8 @@
 // Utility methods.
 //===----------------------------------------------------------------------===//
 
-const GRState *ExprEngine::getInitialState(const LocationContext *InitLoc) {
-  const GRState *state = StateMgr.getInitialState(InitLoc);
+const ProgramState *ExprEngine::getInitialState(const LocationContext *InitLoc) {
+  const ProgramState *state = StateMgr.getInitialState(InitLoc);
 
   // Preconditions.
 
@@ -129,7 +129,7 @@
       if (!Constraint)
         break;
 
-      if (const GRState *newState = state->assume(*Constraint, true))
+      if (const ProgramState *newState = state->assume(*Constraint, true))
         state = newState;
 
       break;
@@ -180,7 +180,7 @@
 
 /// evalAssume - Called by ConstraintManager. Used to call checker-specific
 ///  logic for handling assumptions on symbolic values.
-const GRState *ExprEngine::processAssume(const GRState *state, SVal cond,
+const ProgramState *ExprEngine::processAssume(const ProgramState *state, SVal cond,
                                            bool assumption) {
   state = getCheckerManager().runCheckersForEvalAssume(state, cond, assumption);
 
@@ -191,12 +191,12 @@
   return TF->evalAssume(state, cond, assumption);
 }
 
-bool ExprEngine::wantsRegionChangeUpdate(const GRState *state) {
+bool ExprEngine::wantsRegionChangeUpdate(const ProgramState *state) {
   return getCheckerManager().wantsRegionChangeUpdate(state);
 }
 
-const GRState *
-ExprEngine::processRegionChanges(const GRState *state,
+const ProgramState *
+ExprEngine::processRegionChanges(const ProgramState *state,
                             const StoreManager::InvalidatedSymbols *invalidated,
                                  const MemRegion * const *Begin,
                                  const MemRegion * const *End) {
@@ -234,7 +234,7 @@
 
   // Reclaim any unnecessary nodes in the ExplodedGraph.
   G.reclaimRecentlyAllocatedNodes();
-  // Recycle any unused states in the GRStateManager.
+  // Recycle any unused states in the ProgramStateManager.
   StateMgr.recycleUnusedStates();
   
   currentStmt = S.getStmt();
@@ -247,7 +247,7 @@
   Builder = &builder;
   EntryNode = builder.getPredecessor();
 
-  const GRState *EntryState = EntryNode->getState();
+  const ProgramState *EntryState = EntryNode->getState();
   CleanedState = EntryState;
   ExplodedNode *CleanedNode = 0;
 
@@ -299,7 +299,7 @@
     // states as the predecessors.
     for (ExplodedNodeSet::const_iterator I = Tmp3.begin(), E = Tmp3.end();
                                          I != E; ++I) {
-      const GRState *CheckerState = (*I)->getState();
+      const ProgramState *CheckerState = (*I)->getState();
 
       // The constraint manager has not been cleaned up yet, so clean up now.
       CheckerState = getConstraintManager().removeDeadBindings(CheckerState,
@@ -314,7 +314,7 @@
 
       // Create a state based on CleanedState with CheckerState GDM and
       // generate a transition to that state.
-      const GRState *CleanedCheckerSt =
+      const ProgramState *CleanedCheckerSt =
         StateMgr.getPersistentStateWithGDM(CleanedState, CheckerState);
       ExplodedNode *CleanedNode = Builder->generateNode(currentStmt,
                                                         CleanedCheckerSt, *I,
@@ -358,7 +358,7 @@
 
     for (ExplodedNodeSet::iterator I = Dst.begin(), E = Dst.end(); I != E; ++I){
       ExplodedNode *Pred = *I;
-      const GRState *state = Pred->getState();
+      const ProgramState *state = Pred->getState();
 
       const FieldDecl *FD = BMI->getAnyMember();
 
@@ -415,7 +415,7 @@
 void ExprEngine::ProcessAutomaticObjDtor(const CFGAutomaticObjDtor dtor,
                                            StmtNodeBuilder &builder) {
   ExplodedNode *pred = builder.getPredecessor();
-  const GRState *state = pred->getState();
+  const ProgramState *state = pred->getState();
   const VarDecl *varDecl = dtor.getVarDecl();
 
   QualType varType = varDecl->getType();
@@ -535,7 +535,7 @@
 
     case Stmt::GNUNullExprClass: {
       // GNU __null is a pointer-width integer, not an actual pointer.
-      const GRState *state = Pred->getState();
+      const ProgramState *state = Pred->getState();
       state = state->BindExpr(S, svalBuilder.makeIntValWithPtrWidth(0, false));
       MakeNode(Dst, S, Pred, state);
       break;
@@ -550,7 +550,7 @@
       break;
 
     case Stmt::ImplicitValueInitExprClass: {
-      const GRState *state = Pred->getState();
+      const ProgramState *state = Pred->getState();
       QualType ty = cast<ImplicitValueInitExpr>(S)->getType();
       SVal val = svalBuilder.makeZeroVal(ty);
       MakeNode(Dst, S, Pred, state->BindExpr(S, val));
@@ -621,7 +621,7 @@
         break;
       }
       else if (B->getOpcode() == BO_Comma) {
-        const GRState *state = Pred->getState();
+        const ProgramState *state = Pred->getState();
         MakeNode(Dst, B, Pred, state->BindExpr(B, state->getSVal(B->getRHS())));
         break;
       }
@@ -791,7 +791,7 @@
       }
 
       if (Expr *LastExpr = dyn_cast<Expr>(*SE->getSubStmt()->body_rbegin())) {
-        const GRState *state = Pred->getState();
+        const ProgramState *state = Pred->getState();
         MakeNode(Dst, SE, Pred, state->BindExpr(SE, state->getSVal(LastExpr)));
       }
       else
@@ -801,7 +801,7 @@
     }
 
     case Stmt::StringLiteralClass: {
-      const GRState *state = Pred->getState();
+      const ProgramState *state = Pred->getState();
       SVal V = state->getLValue(cast<StringLiteral>(S));
       MakeNode(Dst, S, Pred, state->BindExpr(S, V));
       return;
@@ -845,7 +845,7 @@
 //===----------------------------------------------------------------------===//
 
 ExplodedNode *ExprEngine::MakeNode(ExplodedNodeSet &Dst, const Stmt *S,
-                                   ExplodedNode *Pred, const GRState *St,
+                                   ExplodedNode *Pred, const ProgramState *St,
                                    ProgramPoint::Kind K,
                                    const ProgramPointTag *tag) {
   assert (Builder && "StmtNodeBuilder not present.");
@@ -858,7 +858,7 @@
 // Branch processing.
 //===----------------------------------------------------------------------===//
 
-const GRState *ExprEngine::MarkBranch(const GRState *state,
+const ProgramState *ExprEngine::MarkBranch(const ProgramState *state,
                                         const Stmt *Terminator,
                                         bool branchTaken) {
 
@@ -919,7 +919,7 @@
 /// integers that promote their values (which are currently not tracked well).
 /// This function returns the SVal bound to Condition->IgnoreCasts if all the
 //  cast(s) did was sign-extend the original value.
-static SVal RecoverCastedSymbol(GRStateManager& StateMgr, const GRState *state,
+static SVal RecoverCastedSymbol(ProgramStateManager& StateMgr, const ProgramState *state,
                                 const Stmt *Condition, ASTContext &Ctx) {
 
   const Expr *Ex = dyn_cast<Expr>(Condition);
@@ -972,7 +972,7 @@
   if (!builder.isFeasible(true) && !builder.isFeasible(false))
     return;
 
-  const GRState *PrevState = builder.getState();
+  const ProgramState *PrevState = builder.getState();
   SVal X = PrevState->getSVal(Condition);
 
   if (X.isUnknownOrUndef()) {
@@ -1004,7 +1004,7 @@
 
   // Process the true branch.
   if (builder.isFeasible(true)) {
-    if (const GRState *state = PrevState->assume(V, true))
+    if (const ProgramState *state = PrevState->assume(V, true))
       builder.generateNode(MarkBranch(state, Term, true), true);
     else
       builder.markInfeasible(true);
@@ -1012,7 +1012,7 @@
 
   // Process the false branch.
   if (builder.isFeasible(false)) {
-    if (const GRState *state = PrevState->assume(V, false))
+    if (const ProgramState *state = PrevState->assume(V, false))
       builder.generateNode(MarkBranch(state, Term, false), false);
     else
       builder.markInfeasible(false);
@@ -1023,7 +1023,7 @@
 ///  nodes by processing the 'effects' of a computed goto jump.
 void ExprEngine::processIndirectGoto(IndirectGotoNodeBuilder &builder) {
 
-  const GRState *state = builder.getState();
+  const ProgramState *state = builder.getState();
   SVal V = state->getSVal(builder.getTarget());
 
   // Three possibilities:
@@ -1072,7 +1072,7 @@
   assert(Ex == currentStmt &&
          Pred->getLocationContext()->getCFG()->isBlkExpr(Ex));
 
-  const GRState *state = Pred->getState();
+  const ProgramState *state = Pred->getState();
   SVal X = state->getSVal(Ex);
 
   assert (X.isUndef());
@@ -1097,7 +1097,7 @@
 ///  nodes by processing the 'effects' of a switch statement.
 void ExprEngine::processSwitch(SwitchNodeBuilder& builder) {
   typedef SwitchNodeBuilder::iterator iterator;
-  const GRState *state = builder.getState();
+  const ProgramState *state = builder.getState();
   const Expr *CondE = builder.getCondition();
   SVal  CondV_untested = state->getSVal(CondE);
 
@@ -1110,7 +1110,7 @@
   }
   DefinedOrUnknownSVal CondV = cast<DefinedOrUnknownSVal>(CondV_untested);
 
-  const GRState *DefaultSt = state;
+  const ProgramState *DefaultSt = state;
   
   iterator I = builder.begin(), EI = builder.end();
   bool defaultIsFeasible = I == EI;
@@ -1155,7 +1155,7 @@
                                                CondV, CaseVal);
 
       // Now "assume" that the case matches.
-      if (const GRState *stateNew = state->assume(Res, true)) {
+      if (const ProgramState *stateNew = state->assume(Res, true)) {
         builder.generateCaseStmtNode(I, stateNew);
 
         // If CondV evaluates to a constant, then we know that this
@@ -1168,7 +1168,7 @@
       // Now "assume" that the case doesn't match.  Add this state
       // to the default state (if it is feasible).
       if (DefaultSt) {
-        if (const GRState *stateNew = DefaultSt->assume(Res, false)) {
+        if (const ProgramState *stateNew = DefaultSt->assume(Res, false)) {
           defaultIsFeasible = true;
           DefaultSt = stateNew;
         }
@@ -1209,12 +1209,12 @@
 }
 
 void ExprEngine::processCallEnter(CallEnterNodeBuilder &B) {
-  const GRState *state = B.getState()->enterStackFrame(B.getCalleeContext());
+  const ProgramState *state = B.getState()->enterStackFrame(B.getCalleeContext());
   B.generateNode(state);
 }
 
 void ExprEngine::processCallExit(CallExitNodeBuilder &B) {
-  const GRState *state = B.getState();
+  const ProgramState *state = B.getState();
   const ExplodedNode *Pred = B.getPredecessor();
   const StackFrameContext *calleeCtx = 
                             cast<StackFrameContext>(Pred->getLocationContext());
@@ -1254,7 +1254,7 @@
 
   assert(B==currentStmt && Pred->getLocationContext()->getCFG()->isBlkExpr(B));
 
-  const GRState *state = Pred->getState();
+  const ProgramState *state = Pred->getState();
   SVal X = state->getSVal(B);
   assert(X.isUndef());
 
@@ -1278,11 +1278,11 @@
     // value later when necessary.  We don't have the machinery in place for
     // this right now, and since most logical expressions are used for branches,
     // the payoff is not likely to be large.  Instead, we do eager evaluation.
-    if (const GRState *newState = state->assume(XD, true))
+    if (const ProgramState *newState = state->assume(XD, true))
       MakeNode(Dst, B, Pred,
                newState->BindExpr(B, svalBuilder.makeIntVal(1U, B->getType())));
 
-    if (const GRState *newState = state->assume(XD, false))
+    if (const ProgramState *newState = state->assume(XD, false))
       MakeNode(Dst, B, Pred,
                newState->BindExpr(B, svalBuilder.makeIntVal(0U, B->getType())));
   }
@@ -1319,7 +1319,7 @@
 void ExprEngine::VisitCommonDeclRefExpr(const Expr *Ex, const NamedDecl *D,
                                         ExplodedNode *Pred,
                                         ExplodedNodeSet &Dst) {
-  const GRState *state = Pred->getState();
+  const ProgramState *state = Pred->getState();
 
   if (const VarDecl *VD = dyn_cast<VarDecl>(D)) {
     assert(Ex->isLValue());
@@ -1368,7 +1368,7 @@
 
   for (ExplodedNodeSet::iterator it = checkerPreStmt.begin(),
                                  ei = checkerPreStmt.end(); it != ei; ++it) {
-    const GRState *state = (*it)->getState();
+    const ProgramState *state = (*it)->getState();
     SVal V = state->getLValue(A->getType(), state->getSVal(Idx),
                               state->getSVal(Base));
     assert(A->isLValue());
@@ -1385,7 +1385,7 @@
     return;
 
   Expr *baseExpr = M->getBase()->IgnoreParens();
-  const GRState *state = Pred->getState();
+  const ProgramState *state = Pred->getState();
   SVal baseExprVal = state->getSVal(baseExpr);
   if (isa<nonloc::LazyCompoundVal>(baseExprVal) ||
       isa<nonloc::CompoundVal>(baseExprVal) ||
@@ -1412,7 +1412,7 @@
 /// evalBind - Handle the semantics of binding a value to a specific location.
 ///  This method is used by evalStore and (soon) VisitDeclStmt, and others.
 void ExprEngine::evalBind(ExplodedNodeSet &Dst, const Stmt *StoreE,
-                            ExplodedNode *Pred, const GRState *state,
+                            ExplodedNode *Pred, const ProgramState *state,
                             SVal location, SVal Val, bool atDeclInit) {
 
 
@@ -1428,7 +1428,7 @@
     if (Pred != *I)
       state = (*I)->getState();
 
-    const GRState *newState = 0;
+    const ProgramState *newState = 0;
 
     if (atDeclInit) {
       const VarRegion *VR =
@@ -1475,7 +1475,7 @@
 void ExprEngine::evalStore(ExplodedNodeSet &Dst, const Expr *AssignE,
                              const Expr *LocationE,
                              ExplodedNode *Pred,
-                             const GRState *state, SVal location, SVal Val,
+                             const ProgramState *state, SVal location, SVal Val,
                              const ProgramPointTag *tag) {
 
   assert(Builder && "StmtNodeBuilder must be defined.");
@@ -1509,7 +1509,7 @@
 
 void ExprEngine::evalLoad(ExplodedNodeSet &Dst, const Expr *Ex,
                             ExplodedNode *Pred,
-                            const GRState *state, SVal location,
+                            const ProgramState *state, SVal location,
                             const ProgramPointTag *tag, QualType LoadTy) {
   assert(!isa<NonLoc>(location) && "location cannot be a NonLoc.");
 
@@ -1548,7 +1548,7 @@
 
 void ExprEngine::evalLoadCommon(ExplodedNodeSet &Dst, const Expr *Ex,
                                   ExplodedNode *Pred,
-                                  const GRState *state, SVal location,
+                                  const ProgramState *state, SVal location,
                                   const ProgramPointTag *tag, QualType LoadTy) {
 
   // Evaluate the location (checks for bad dereferences).
@@ -1584,7 +1584,7 @@
 
 void ExprEngine::evalLocation(ExplodedNodeSet &Dst, const Stmt *S,
                                 ExplodedNode *Pred,
-                                const GRState *state, SVal location,
+                                const ProgramState *state, SVal location,
                                 const ProgramPointTag *tag, bool isLoad) {
   // Early checks for performance reason.
   if (location.isUnknown()) {
@@ -1626,7 +1626,7 @@
   // cases as well.
   
 #if 0
-  const GRState *state = Pred->getState();
+  const ProgramState *state = Pred->getState();
   const Expr *Callee = CE->getCallee();
   SVal L = state->getSVal(Callee);
   
@@ -1721,7 +1721,7 @@
 
       // Dispatch to transfer function logic to handle the call itself.
       const Expr *Callee = CE->getCallee()->IgnoreParens();
-      const GRState *state = Pred->getState();
+      const ProgramState *state = Pred->getState();
       SVal L = state->getSVal(Callee);
       Eng.getTF().evalCall(Dst, Eng, Builder, CE, L, Pred);
 
@@ -1778,11 +1778,11 @@
       continue;
     }
 
-    const GRState *state = Pred->getState();
+    const ProgramState *state = Pred->getState();
     SVal V = state->getSVal(Ex);
     if (nonloc::SymExprVal *SEV = dyn_cast<nonloc::SymExprVal>(&V)) {
       // First assume that the condition is true.
-      if (const GRState *stateTrue = state->assume(*SEV, true)) {
+      if (const ProgramState *stateTrue = state->assume(*SEV, true)) {
         stateTrue = stateTrue->BindExpr(Ex,
                                         svalBuilder.makeIntVal(1U, Ex->getType()));
         Dst.Add(Builder->generateNode(PostStmtCustom(Ex,
@@ -1791,7 +1791,7 @@
       }
 
       // Next, assume that the condition is false.
-      if (const GRState *stateFalse = state->assume(*SEV, false)) {
+      if (const ProgramState *stateFalse = state->assume(*SEV, false)) {
         stateFalse = stateFalse->BindExpr(Ex,
                                           svalBuilder.makeIntVal(0U, Ex->getType()));
         Dst.Add(Builder->generateNode(PostStmtCustom(Ex, &EagerlyAssumeTag,
@@ -1822,7 +1822,7 @@
                                           ExplodedNode *Pred,
                                           ExplodedNodeSet &Dst) {
 
-  const GRState *state = Pred->getState();
+  const ProgramState *state = Pred->getState();
   SVal baseVal = state->getSVal(Ex->getBase());
   SVal location = state->getLValue(Ex->getDecl(), baseVal);
 
@@ -1867,7 +1867,7 @@
   //    result in state splitting.
 
   const Stmt *elem = S->getElement();
-  const GRState *state = Pred->getState();
+  const ProgramState *state = Pred->getState();
   SVal elementV;
 
   if (const DeclStmt *DS = dyn_cast<DeclStmt>(elem)) {
@@ -1888,15 +1888,15 @@
   for (ExplodedNodeSet::iterator NI = dstLocation.begin(),
                                  NE = dstLocation.end(); NI!=NE; ++NI) {
     Pred = *NI;
-    const GRState *state = Pred->getState();
+    const ProgramState *state = Pred->getState();
     
     // Handle the case where the container still has elements.
     SVal TrueV = svalBuilder.makeTruthVal(1);
-    const GRState *hasElems = state->BindExpr(S, TrueV);
+    const ProgramState *hasElems = state->BindExpr(S, TrueV);
     
     // Handle the case where the container has no elements.
     SVal FalseV = svalBuilder.makeTruthVal(0);
-    const GRState *noElems = state->BindExpr(S, FalseV);
+    const ProgramState *noElems = state->BindExpr(S, FalseV);
     
     if (loc::MemRegionVal *MV = dyn_cast<loc::MemRegionVal>(&elementV))
       if (const TypedValueRegion *R = 
@@ -1947,13 +1947,13 @@
     SaveOr OldHasGen(Builder->hasGeneratedNode);
 
     if (const Expr *Receiver = msg.getInstanceReceiver()) {
-      const GRState *state = Pred->getState();
+      const ProgramState *state = Pred->getState();
       SVal recVal = state->getSVal(Receiver);
       if (!recVal.isUndef()) {
         // Bifurcate the state into nil and non-nil ones.
         DefinedOrUnknownSVal receiverVal = cast<DefinedOrUnknownSVal>(recVal);
     
-        const GRState *notNilState, *nilState;
+        const ProgramState *notNilState, *nilState;
         llvm::tie(notNilState, nilState) = state->assume(receiverVal);
     
         // There are three cases: can be nil or non-nil, must be nil, must be
@@ -2053,7 +2053,7 @@
     for (ExplodedNodeSet::iterator I = dstPreStmt.begin(), E = dstPreStmt.end();
          I!=E; ++I) {
       ExplodedNode *subExprNode = *I;
-      const GRState *state = subExprNode->getState();
+      const ProgramState *state = subExprNode->getState();
       evalLoad(Dst, CastE, subExprNode, state, state->getSVal(Ex));
     }
     return;
@@ -2088,7 +2088,7 @@
       case CK_NoOp:
       case CK_FunctionToPointerDecay: {
         // Copy the SVal of Ex to CastE.
-        const GRState *state = Pred->getState();
+        const ProgramState *state = Pred->getState();
         SVal V = state->getSVal(Ex);
         state = state->BindExpr(CastE, V);
         MakeNode(Dst, CastE, Pred, state);
@@ -2122,7 +2122,7 @@
       case CK_AnyPointerToBlockPointerCast:  
       case CK_ObjCObjectLValueCast: {
         // Delegate to SValBuilder to process.
-        const GRState *state = Pred->getState();
+        const ProgramState *state = Pred->getState();
         SVal V = state->getSVal(Ex);
         V = svalBuilder.evalCast(V, T, ExTy);
         state = state->BindExpr(CastE, V);
@@ -2132,7 +2132,7 @@
       case CK_DerivedToBase:
       case CK_UncheckedDerivedToBase: {
         // For DerivedToBase cast, delegate to the store manager.
-        const GRState *state = Pred->getState();
+        const ProgramState *state = Pred->getState();
         SVal val = state->getSVal(Ex);
         val = getStoreManager().evalDerivedToBase(val, T);
         state = state->BindExpr(CastE, val);
@@ -2159,7 +2159,7 @@
           svalBuilder.getConjuredSymbolVal(NULL, CastE, resultType,
                                            Builder->getCurrentBlockCount());
 
-        const GRState *state = Pred->getState()->BindExpr(CastE, result);
+        const ProgramState *state = Pred->getState()->BindExpr(CastE, result);
         MakeNode(Dst, CastE, Pred, state);
         continue;
       }
@@ -2173,7 +2173,7 @@
   const InitListExpr *ILE 
     = cast<InitListExpr>(CL->getInitializer()->IgnoreParens());
   
-  const GRState *state = Pred->getState();
+  const ProgramState *state = Pred->getState();
   SVal ILV = state->getSVal(ILE);
 
   const LocationContext *LC = Pred->getLocationContext();
@@ -2209,7 +2209,7 @@
        I!=E; ++I)
   {
     ExplodedNode *N = *I;
-    const GRState *state = N->getState();
+    const ProgramState *state = N->getState();
 
     // Decls without InitExpr are not initialized explicitly.
     const LocationContext *LC = N->getLocationContext();
@@ -2246,7 +2246,7 @@
 void ExprEngine::VisitInitListExpr(const InitListExpr *IE, ExplodedNode *Pred,
                                     ExplodedNodeSet &Dst) {
 
-  const GRState *state = Pred->getState();
+  const ProgramState *state = Pred->getState();
   QualType T = getContext().getCanonicalType(IE->getType());
   unsigned NumInitElements = IE->getNumInits();
 
@@ -2302,7 +2302,7 @@
       // Get the size by getting the extent of the sub-expression.
       // First, visit the sub-expression to find its region.
       const Expr *Arg = Ex->getArgumentExpr();
-      const GRState *state = Pred->getState();
+      const ProgramState *state = Pred->getState();
       const MemRegion *MR = state->getSVal(Arg).getAsRegion();
 
       // If the subexpression can't be resolved to a region, we don't know
@@ -2377,7 +2377,7 @@
 
         // For all other types, UO_Real is an identity operation.
         assert (U->getType() == Ex->getType());
-        const GRState *state = (*I)->getState();
+        const ProgramState *state = (*I)->getState();
         MakeNode(Dst, U, *I, state->BindExpr(U, state->getSVal(Ex)));
       }
 
@@ -2399,7 +2399,7 @@
         }
 
         // For all other types, UO_Imag returns 0.
-        const GRState *state = (*I)->getState();
+        const ProgramState *state = (*I)->getState();
         SVal X = svalBuilder.makeZeroVal(Ex->getType());
         MakeNode(Dst, U, *I, state->BindExpr(U, X));
       }
@@ -2424,7 +2424,7 @@
       Visit(Ex, Pred, Tmp);
 
       for (ExplodedNodeSet::iterator I=Tmp.begin(), E=Tmp.end(); I!=E; ++I) {
-        const GRState *state = (*I)->getState();
+        const ProgramState *state = (*I)->getState();
         MakeNode(Dst, U, *I, state->BindExpr(U, state->getSVal(Ex)));
       }
 
@@ -2440,7 +2440,7 @@
       Visit(Ex, Pred, Tmp);
 
       for (ExplodedNodeSet::iterator I=Tmp.begin(), E=Tmp.end(); I!=E; ++I) {
-        const GRState *state = (*I)->getState();
+        const ProgramState *state = (*I)->getState();
 
         // Get the value of the subexpression.
         SVal V = state->getSVal(Ex);
@@ -2515,7 +2515,7 @@
 
   for (ExplodedNodeSet::iterator I = Tmp.begin(), E = Tmp.end(); I!=E; ++I) {
 
-    const GRState *state = (*I)->getState();
+    const ProgramState *state = (*I)->getState();
     SVal loc = state->getSVal(Ex);
 
     // Perform a load.
@@ -2626,7 +2626,7 @@
     // which interprets the inline asm and stores proper results in the
     // outputs.
 
-    const GRState *state = Pred->getState();
+    const ProgramState *state = Pred->getState();
 
     for (AsmStmt::const_outputs_iterator OI = A->begin_outputs(),
                                    OE = A->end_outputs(); OI != OE; ++OI) {
@@ -2659,7 +2659,7 @@
     // processCallExit to bind the return value to the call expr.
     {
       static SimpleProgramPointTag tag("ExprEngine: ReturnStmt");
-      const GRState *state = Pred->getState();
+      const ProgramState *state = Pred->getState();
       state = state->set<ReturnExpr>(RetE);
       Pred = Builder->generateNode(RetE, state, Pred, &tag);
     }
@@ -2721,7 +2721,7 @@
     for (ExplodedNodeSet::iterator I2=CheckedSet.begin(), E2=CheckedSet.end();
          I2 != E2; ++I2) {
 
-      const GRState *state = (*I2)->getState();
+      const ProgramState *state = (*I2)->getState();
       SVal RightV = state->getSVal(RHS);
 
       BinaryOperator::Opcode Op = B->getOpcode();
@@ -3025,7 +3025,7 @@
       }
     }
 
-    const GRState *state = N->getState();
+    const ProgramState *state = N->getState();
     Out << "\\|StateID: " << (void*) state
         << " NodeID: " << (void*) N << "\\|";
     state->printDOT(Out, *N->getLocationContext()->getCFG());
diff --git a/lib/StaticAnalyzer/Core/GRState.cpp b/lib/StaticAnalyzer/Core/GRState.cpp
deleted file mode 100644
index bf6ec19..0000000
--- a/lib/StaticAnalyzer/Core/GRState.cpp
+++ /dev/null
@@ -1,662 +0,0 @@
-//= GRState.cpp - Path-Sensitive "State" for tracking values -----*- C++ -*--=//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-//  This file implements GRState and GRStateManager.
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/Analysis/CFG.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/GRStateTrait.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/GRState.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/TransferFuncs.h"
-#include "llvm/Support/raw_ostream.h"
-
-using namespace clang;
-using namespace ento;
-
-// Give the vtable for ConstraintManager somewhere to live.
-// FIXME: Move this elsewhere.
-ConstraintManager::~ConstraintManager() {}
-
-GRState::GRState(GRStateManager *mgr, const Environment& env,
-                 StoreRef st, GenericDataMap gdm)
-  : stateMgr(mgr),
-    Env(env),
-    store(st.getStore()),
-    GDM(gdm),
-    refCount(0) {
-  stateMgr->getStoreManager().incrementReferenceCount(store);
-}
-
-GRState::GRState(const GRState &RHS)
-    : llvm::FoldingSetNode(),
-      stateMgr(RHS.stateMgr),
-      Env(RHS.Env),
-      store(RHS.store),
-      GDM(RHS.GDM),
-      refCount(0) {
-  stateMgr->getStoreManager().incrementReferenceCount(store);
-}
-
-GRState::~GRState() {
-  if (store)
-    stateMgr->getStoreManager().decrementReferenceCount(store);
-}
-
-GRStateManager::~GRStateManager() {
-  for (std::vector<GRState::Printer*>::iterator I=Printers.begin(),
-        E=Printers.end(); I!=E; ++I)
-    delete *I;
-
-  for (GDMContextsTy::iterator I=GDMContexts.begin(), E=GDMContexts.end();
-       I!=E; ++I)
-    I->second.second(I->second.first);
-}
-
-const GRState*
-GRStateManager::removeDeadBindings(const GRState *state,
-                                   const StackFrameContext *LCtx,
-                                   SymbolReaper& SymReaper) {
-
-  // This code essentially performs a "mark-and-sweep" of the VariableBindings.
-  // The roots are any Block-level exprs and Decls that our liveness algorithm
-  // tells us are live.  We then see what Decls they may reference, and keep
-  // those around.  This code more than likely can be made faster, and the
-  // frequency of which this method is called should be experimented with
-  // for optimum performance.
-  GRState NewState = *state;
-
-  NewState.Env = EnvMgr.removeDeadBindings(NewState.Env, SymReaper, state);
-
-  // Clean up the store.
-  StoreRef newStore = StoreMgr->removeDeadBindings(NewState.getStore(), LCtx,
-                                                   SymReaper);
-  NewState.setStore(newStore);
-  SymReaper.setReapedStore(newStore);
-  
-  return getPersistentState(NewState);
-}
-
-const GRState *GRStateManager::MarshalState(const GRState *state,
-                                            const StackFrameContext *InitLoc) {
-  // make up an empty state for now.
-  GRState State(this,
-                EnvMgr.getInitialEnvironment(),
-                StoreMgr->getInitialStore(InitLoc),
-                GDMFactory.getEmptyMap());
-
-  return getPersistentState(State);
-}
-
-const GRState *GRState::bindCompoundLiteral(const CompoundLiteralExpr *CL,
-                                            const LocationContext *LC,
-                                            SVal V) const {
-  const StoreRef &newStore = 
-    getStateManager().StoreMgr->BindCompoundLiteral(getStore(), CL, LC, V);
-  return makeWithStore(newStore);
-}
-
-const GRState *GRState::bindDecl(const VarRegion* VR, SVal IVal) const {
-  const StoreRef &newStore =
-    getStateManager().StoreMgr->BindDecl(getStore(), VR, IVal);
-  return makeWithStore(newStore);
-}
-
-const GRState *GRState::bindDeclWithNoInit(const VarRegion* VR) const {
-  const StoreRef &newStore =
-    getStateManager().StoreMgr->BindDeclWithNoInit(getStore(), VR);
-  return makeWithStore(newStore);
-}
-
-const GRState *GRState::bindLoc(Loc LV, SVal V) const {
-  GRStateManager &Mgr = getStateManager();
-  const GRState *newState = makeWithStore(Mgr.StoreMgr->Bind(getStore(), 
-                                                             LV, V));
-  const MemRegion *MR = LV.getAsRegion();
-  if (MR && Mgr.getOwningEngine())
-    return Mgr.getOwningEngine()->processRegionChange(newState, MR);
-
-  return newState;
-}
-
-const GRState *GRState::bindDefault(SVal loc, SVal V) const {
-  GRStateManager &Mgr = getStateManager();
-  const MemRegion *R = cast<loc::MemRegionVal>(loc).getRegion();
-  const StoreRef &newStore = Mgr.StoreMgr->BindDefault(getStore(), R, V);
-  const GRState *new_state = makeWithStore(newStore);
-  return Mgr.getOwningEngine() ? 
-           Mgr.getOwningEngine()->processRegionChange(new_state, R) : 
-           new_state;
-}
-
-const GRState *GRState::invalidateRegions(const MemRegion * const *Begin,
-                                          const MemRegion * const *End,
-                                          const Expr *E, unsigned Count,
-                                          StoreManager::InvalidatedSymbols *IS,
-                                          bool invalidateGlobals) const {
-  if (!IS) {
-    StoreManager::InvalidatedSymbols invalidated;
-    return invalidateRegionsImpl(Begin, End, E, Count,
-                             invalidated, invalidateGlobals);
-  }
-  return invalidateRegionsImpl(Begin, End, E, Count, *IS, invalidateGlobals);
-}
-
-const GRState *
-GRState::invalidateRegionsImpl(const MemRegion * const *Begin,
-                               const MemRegion * const *End,
-                               const Expr *E, unsigned Count,
-                               StoreManager::InvalidatedSymbols &IS,
-                               bool invalidateGlobals) const {
-  GRStateManager &Mgr = getStateManager();
-  SubEngine* Eng = Mgr.getOwningEngine();
- 
-  if (Eng && Eng->wantsRegionChangeUpdate(this)) {
-    StoreManager::InvalidatedRegions Regions;
-    const StoreRef &newStore
-      = Mgr.StoreMgr->invalidateRegions(getStore(), Begin, End, E, Count, IS,
-                                        invalidateGlobals, &Regions);
-    const GRState *newState = makeWithStore(newStore);
-    return Eng->processRegionChanges(newState, &IS,
-                                     &Regions.front(),
-                                     &Regions.back()+1);
-  }
-
-  const StoreRef &newStore =
-    Mgr.StoreMgr->invalidateRegions(getStore(), Begin, End, E, Count, IS,
-                                    invalidateGlobals, NULL);
-  return makeWithStore(newStore);
-}
-
-const GRState *GRState::unbindLoc(Loc LV) const {
-  assert(!isa<loc::MemRegionVal>(LV) && "Use invalidateRegion instead.");
-
-  Store OldStore = getStore();
-  const StoreRef &newStore = getStateManager().StoreMgr->Remove(OldStore, LV);
-
-  if (newStore.getStore() == OldStore)
-    return this;
-
-  return makeWithStore(newStore);
-}
-
-const GRState *GRState::enterStackFrame(const StackFrameContext *frame) const {
-  const StoreRef &new_store =
-    getStateManager().StoreMgr->enterStackFrame(this, frame);
-  return makeWithStore(new_store);
-}
-
-SVal GRState::getSValAsScalarOrLoc(const MemRegion *R) const {
-  // We only want to do fetches from regions that we can actually bind
-  // values.  For example, SymbolicRegions of type 'id<...>' cannot
-  // have direct bindings (but their can be bindings on their subregions).
-  if (!R->isBoundable())
-    return UnknownVal();
-
-  if (const TypedValueRegion *TR = dyn_cast<TypedValueRegion>(R)) {
-    QualType T = TR->getValueType();
-    if (Loc::isLocType(T) || T->isIntegerType())
-      return getSVal(R);
-  }
-
-  return UnknownVal();
-}
-
-SVal GRState::getSVal(Loc location, QualType T) const {
-  SVal V = getRawSVal(cast<Loc>(location), T);
-
-  // If 'V' is a symbolic value that is *perfectly* constrained to
-  // be a constant value, use that value instead to lessen the burden
-  // on later analysis stages (so we have less symbolic values to reason
-  // about).
-  if (!T.isNull()) {
-    if (SymbolRef sym = V.getAsSymbol()) {
-      if (const llvm::APSInt *Int = getSymVal(sym)) {
-        // FIXME: Because we don't correctly model (yet) sign-extension
-        // and truncation of symbolic values, we need to convert
-        // the integer value to the correct signedness and bitwidth.
-        //
-        // This shows up in the following:
-        //
-        //   char foo();
-        //   unsigned x = foo();
-        //   if (x == 54)
-        //     ...
-        //
-        //  The symbolic value stored to 'x' is actually the conjured
-        //  symbol for the call to foo(); the type of that symbol is 'char',
-        //  not unsigned.
-        const llvm::APSInt &NewV = getBasicVals().Convert(T, *Int);
-        
-        if (isa<Loc>(V))
-          return loc::ConcreteInt(NewV);
-        else
-          return nonloc::ConcreteInt(NewV);
-      }
-    }
-  }
-  
-  return V;
-}
-
-const GRState *GRState::BindExpr(const Stmt *S, SVal V, bool Invalidate) const{
-  Environment NewEnv = getStateManager().EnvMgr.bindExpr(Env, S, V,
-                                                         Invalidate);
-  if (NewEnv == Env)
-    return this;
-
-  GRState NewSt = *this;
-  NewSt.Env = NewEnv;
-  return getStateManager().getPersistentState(NewSt);
-}
-
-const GRState *GRState::bindExprAndLocation(const Stmt *S, SVal location,
-                                            SVal V) const {
-  Environment NewEnv =
-    getStateManager().EnvMgr.bindExprAndLocation(Env, S, location, V);
-
-  if (NewEnv == Env)
-    return this;
-  
-  GRState NewSt = *this;
-  NewSt.Env = NewEnv;
-  return getStateManager().getPersistentState(NewSt);
-}
-
-const GRState *GRState::assumeInBound(DefinedOrUnknownSVal Idx,
-                                      DefinedOrUnknownSVal UpperBound,
-                                      bool Assumption) const {
-  if (Idx.isUnknown() || UpperBound.isUnknown())
-    return this;
-
-  // Build an expression for 0 <= Idx < UpperBound.
-  // This is the same as Idx + MIN < UpperBound + MIN, if overflow is allowed.
-  // FIXME: This should probably be part of SValBuilder.
-  GRStateManager &SM = getStateManager();
-  SValBuilder &svalBuilder = SM.getSValBuilder();
-  ASTContext &Ctx = svalBuilder.getContext();
-
-  // Get the offset: the minimum value of the array index type.
-  BasicValueFactory &BVF = svalBuilder.getBasicValueFactory();
-  // FIXME: This should be using ValueManager::ArrayindexTy...somehow.
-  QualType indexTy = Ctx.IntTy;
-  nonloc::ConcreteInt Min(BVF.getMinValue(indexTy));
-
-  // Adjust the index.
-  SVal newIdx = svalBuilder.evalBinOpNN(this, BO_Add,
-                                        cast<NonLoc>(Idx), Min, indexTy);
-  if (newIdx.isUnknownOrUndef())
-    return this;
-
-  // Adjust the upper bound.
-  SVal newBound =
-    svalBuilder.evalBinOpNN(this, BO_Add, cast<NonLoc>(UpperBound),
-                            Min, indexTy);
-
-  if (newBound.isUnknownOrUndef())
-    return this;
-
-  // Build the actual comparison.
-  SVal inBound = svalBuilder.evalBinOpNN(this, BO_LT,
-                                cast<NonLoc>(newIdx), cast<NonLoc>(newBound),
-                                Ctx.IntTy);
-  if (inBound.isUnknownOrUndef())
-    return this;
-
-  // Finally, let the constraint manager take care of it.
-  ConstraintManager &CM = SM.getConstraintManager();
-  return CM.assume(this, cast<DefinedSVal>(inBound), Assumption);
-}
-
-const GRState *GRStateManager::getInitialState(const LocationContext *InitLoc) {
-  GRState State(this,
-                EnvMgr.getInitialEnvironment(),
-                StoreMgr->getInitialStore(InitLoc),
-                GDMFactory.getEmptyMap());
-
-  return getPersistentState(State);
-}
-
-void GRStateManager::recycleUnusedStates() {
-  for (std::vector<GRState*>::iterator i = recentlyAllocatedStates.begin(),
-       e = recentlyAllocatedStates.end(); i != e; ++i) {
-    GRState *state = *i;
-    if (state->referencedByExplodedNode())
-      continue;
-    StateSet.RemoveNode(state);
-    freeStates.push_back(state);
-    state->~GRState();
-  }
-  recentlyAllocatedStates.clear();
-}
-
-const GRState *GRStateManager::getPersistentStateWithGDM(
-                                                     const GRState *FromState,
-                                                     const GRState *GDMState) {
-  GRState NewState = *FromState;
-  NewState.GDM = GDMState->GDM;
-  return getPersistentState(NewState);
-}
-
-const GRState *GRStateManager::getPersistentState(GRState &State) {
-
-  llvm::FoldingSetNodeID ID;
-  State.Profile(ID);
-  void *InsertPos;
-
-  if (GRState *I = StateSet.FindNodeOrInsertPos(ID, InsertPos))
-    return I;
-
-  GRState *newState = 0;
-  if (!freeStates.empty()) {
-    newState = freeStates.back();
-    freeStates.pop_back();    
-  }
-  else {
-    newState = (GRState*) Alloc.Allocate<GRState>();
-  }
-  new (newState) GRState(State);
-  StateSet.InsertNode(newState, InsertPos);
-  recentlyAllocatedStates.push_back(newState);
-  return newState;
-}
-
-const GRState *GRState::makeWithStore(const StoreRef &store) const {
-  GRState NewSt = *this;
-  NewSt.setStore(store);
-  return getStateManager().getPersistentState(NewSt);
-}
-
-void GRState::setStore(const StoreRef &newStore) {
-  Store newStoreStore = newStore.getStore();
-  if (newStoreStore)
-    stateMgr->getStoreManager().incrementReferenceCount(newStoreStore);
-  if (store)
-    stateMgr->getStoreManager().decrementReferenceCount(store);
-  store = newStoreStore;
-}
-
-//===----------------------------------------------------------------------===//
-//  State pretty-printing.
-//===----------------------------------------------------------------------===//
-
-static bool IsEnvLoc(const Stmt *S) {
-  // FIXME: This is a layering violation.  Should be in environment.
-  return (bool) (((uintptr_t) S) & 0x1);
-}
-
-void GRState::print(raw_ostream &Out, CFG &C, const char* nl,
-                    const char* sep) const {
-  // Print the store.
-  GRStateManager &Mgr = getStateManager();
-  Mgr.getStoreManager().print(getStore(), Out, nl, sep);
-
-  // Print Subexpression bindings.
-  bool isFirst = true;
-
-  // FIXME: All environment printing should be moved inside Environment.
-  for (Environment::iterator I = Env.begin(), E = Env.end(); I != E; ++I) {
-    if (C.isBlkExpr(I.getKey()) || IsEnvLoc(I.getKey()))
-      continue;
-
-    if (isFirst) {
-      Out << nl << nl << "Sub-Expressions:" << nl;
-      isFirst = false;
-    }
-    else { Out << nl; }
-
-    Out << " (" << (void*) I.getKey() << ") ";
-    LangOptions LO; // FIXME.
-    I.getKey()->printPretty(Out, 0, PrintingPolicy(LO));
-    Out << " : " << I.getData();
-  }
-
-  // Print block-expression bindings.
-  isFirst = true;
-
-  for (Environment::iterator I = Env.begin(), E = Env.end(); I != E; ++I) {
-    if (!C.isBlkExpr(I.getKey()))
-      continue;
-
-    if (isFirst) {
-      Out << nl << nl << "Block-level Expressions:" << nl;
-      isFirst = false;
-    }
-    else { Out << nl; }
-
-    Out << " (" << (void*) I.getKey() << ") ";
-    LangOptions LO; // FIXME.
-    I.getKey()->printPretty(Out, 0, PrintingPolicy(LO));
-    Out << " : " << I.getData();
-  }
-  
-  // Print locations.
-  isFirst = true;
-  
-  for (Environment::iterator I = Env.begin(), E = Env.end(); I != E; ++I) {
-    if (!IsEnvLoc(I.getKey()))
-      continue;
-    
-    if (isFirst) {
-      Out << nl << nl << "Load/store locations:" << nl;
-      isFirst = false;
-    }
-    else { Out << nl; }
-
-    const Stmt *S = (Stmt*) (((uintptr_t) I.getKey()) & ((uintptr_t) ~0x1));
-    
-    Out << " (" << (void*) S << ") ";
-    LangOptions LO; // FIXME.
-    S->printPretty(Out, 0, PrintingPolicy(LO));
-    Out << " : " << I.getData();
-  }
-
-  Mgr.getConstraintManager().print(this, Out, nl, sep);
-
-  // Print checker-specific data.
-  for (std::vector<Printer*>::iterator I = Mgr.Printers.begin(),
-                                       E = Mgr.Printers.end(); I != E; ++I) {
-    (*I)->Print(Out, this, nl, sep);
-  }
-}
-
-void GRState::printDOT(raw_ostream &Out, CFG &C) const {
-  print(Out, C, "\\l", "\\|");
-}
-
-void GRState::printStdErr(CFG &C) const {
-  print(llvm::errs(), C);
-}
-
-//===----------------------------------------------------------------------===//
-// Generic Data Map.
-//===----------------------------------------------------------------------===//
-
-void *const* GRState::FindGDM(void *K) const {
-  return GDM.lookup(K);
-}
-
-void*
-GRStateManager::FindGDMContext(void *K,
-                               void *(*CreateContext)(llvm::BumpPtrAllocator&),
-                               void (*DeleteContext)(void*)) {
-
-  std::pair<void*, void (*)(void*)>& p = GDMContexts[K];
-  if (!p.first) {
-    p.first = CreateContext(Alloc);
-    p.second = DeleteContext;
-  }
-
-  return p.first;
-}
-
-const GRState *GRStateManager::addGDM(const GRState *St, void *Key, void *Data){
-  GRState::GenericDataMap M1 = St->getGDM();
-  GRState::GenericDataMap M2 = GDMFactory.add(M1, Key, Data);
-
-  if (M1 == M2)
-    return St;
-
-  GRState NewSt = *St;
-  NewSt.GDM = M2;
-  return getPersistentState(NewSt);
-}
-
-const GRState *GRStateManager::removeGDM(const GRState *state, void *Key) {
-  GRState::GenericDataMap OldM = state->getGDM();
-  GRState::GenericDataMap NewM = GDMFactory.remove(OldM, Key);
-
-  if (NewM == OldM)
-    return state;
-
-  GRState NewState = *state;
-  NewState.GDM = NewM;
-  return getPersistentState(NewState);
-}
-
-//===----------------------------------------------------------------------===//
-// Utility.
-//===----------------------------------------------------------------------===//
-
-namespace {
-class ScanReachableSymbols : public SubRegionMap::Visitor  {
-  typedef llvm::DenseMap<const void*, unsigned> VisitedItems;
-
-  VisitedItems visited;
-  const GRState *state;
-  SymbolVisitor &visitor;
-  llvm::OwningPtr<SubRegionMap> SRM;
-public:
-
-  ScanReachableSymbols(const GRState *st, SymbolVisitor& v)
-    : state(st), visitor(v) {}
-
-  bool scan(nonloc::CompoundVal val);
-  bool scan(SVal val);
-  bool scan(const MemRegion *R);
-  bool scan(const SymExpr *sym);
-
-  // From SubRegionMap::Visitor.
-  bool Visit(const MemRegion* Parent, const MemRegion* SubRegion) {
-    return scan(SubRegion);
-  }
-};
-}
-
-bool ScanReachableSymbols::scan(nonloc::CompoundVal val) {
-  for (nonloc::CompoundVal::iterator I=val.begin(), E=val.end(); I!=E; ++I)
-    if (!scan(*I))
-      return false;
-
-  return true;
-}
-
-bool ScanReachableSymbols::scan(const SymExpr *sym) {
-  unsigned &isVisited = visited[sym];
-  if (isVisited)
-    return true;
-  isVisited = 1;
-  
-  if (const SymbolData *sData = dyn_cast<SymbolData>(sym))
-    if (!visitor.VisitSymbol(sData))
-      return false;
-  
-  switch (sym->getKind()) {
-    case SymExpr::RegionValueKind:
-    case SymExpr::ConjuredKind:
-    case SymExpr::DerivedKind:
-    case SymExpr::ExtentKind:
-    case SymExpr::MetadataKind:
-      break;
-    case SymExpr::SymIntKind:
-      return scan(cast<SymIntExpr>(sym)->getLHS());
-    case SymExpr::SymSymKind: {
-      const SymSymExpr *x = cast<SymSymExpr>(sym);
-      return scan(x->getLHS()) && scan(x->getRHS());
-    }
-  }
-  return true;
-}
-
-bool ScanReachableSymbols::scan(SVal val) {
-  if (loc::MemRegionVal *X = dyn_cast<loc::MemRegionVal>(&val))
-    return scan(X->getRegion());
-
-  if (nonloc::LocAsInteger *X = dyn_cast<nonloc::LocAsInteger>(&val))
-    return scan(X->getLoc());
-
-  if (SymbolRef Sym = val.getAsSymbol())
-    return scan(Sym);
-
-  if (const SymExpr *Sym = val.getAsSymbolicExpression())
-    return scan(Sym);
-
-  if (nonloc::CompoundVal *X = dyn_cast<nonloc::CompoundVal>(&val))
-    return scan(*X);
-
-  return true;
-}
-
-bool ScanReachableSymbols::scan(const MemRegion *R) {
-  if (isa<MemSpaceRegion>(R))
-    return true;
-  
-  unsigned &isVisited = visited[R];
-  if (isVisited)
-    return true;
-  isVisited = 1;
-
-  // If this is a symbolic region, visit the symbol for the region.
-  if (const SymbolicRegion *SR = dyn_cast<SymbolicRegion>(R))
-    if (!visitor.VisitSymbol(SR->getSymbol()))
-      return false;
-
-  // If this is a subregion, also visit the parent regions.
-  if (const SubRegion *SR = dyn_cast<SubRegion>(R))
-    if (!scan(SR->getSuperRegion()))
-      return false;
-
-  // Now look at the binding to this region (if any).
-  if (!scan(state->getSValAsScalarOrLoc(R)))
-    return false;
-
-  // Now look at the subregions.
-  if (!SRM.get())
-    SRM.reset(state->getStateManager().getStoreManager().
-                                           getSubRegionMap(state->getStore()));
-
-  return SRM->iterSubRegions(R, *this);
-}
-
-bool GRState::scanReachableSymbols(SVal val, SymbolVisitor& visitor) const {
-  ScanReachableSymbols S(this, visitor);
-  return S.scan(val);
-}
-
-bool GRState::scanReachableSymbols(const SVal *I, const SVal *E,
-                                   SymbolVisitor &visitor) const {
-  ScanReachableSymbols S(this, visitor);
-  for ( ; I != E; ++I) {
-    if (!S.scan(*I))
-      return false;
-  }
-  return true;
-}
-
-bool GRState::scanReachableSymbols(const MemRegion * const *I,
-                                   const MemRegion * const *E,
-                                   SymbolVisitor &visitor) const {
-  ScanReachableSymbols S(this, visitor);
-  for ( ; I != E; ++I) {
-    if (!S.scan(*I))
-      return false;
-  }
-  return true;
-}
diff --git a/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp b/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
index b66bce4..6a6bed9 100644
--- a/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
+++ b/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
@@ -8,13 +8,13 @@
 //===----------------------------------------------------------------------===//
 //
 //  This file defines RangeConstraintManager, a class that tracks simple
-//  equality and inequality constraints on symbolic values of GRState.
+//  equality and inequality constraints on symbolic values of ProgramState.
 //
 //===----------------------------------------------------------------------===//
 
 #include "SimpleConstraintManager.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/GRState.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/GRStateTrait.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/TransferFuncs.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/ADT/FoldingSet.h"
@@ -196,8 +196,8 @@
 namespace clang {
 namespace ento {
 template<>
-struct GRStateTrait<ConstraintRange>
-  : public GRStatePartialTrait<ConstraintRangeTy> {
+struct ProgramStateTrait<ConstraintRange>
+  : public ProgramStatePartialTrait<ConstraintRangeTy> {
   static inline void *GDMIndex() { return &ConstraintRangeIndex; }
 };
 }
@@ -205,46 +205,46 @@
 
 namespace {
 class RangeConstraintManager : public SimpleConstraintManager{
-  RangeSet GetRange(const GRState *state, SymbolRef sym);
+  RangeSet GetRange(const ProgramState *state, SymbolRef sym);
 public:
   RangeConstraintManager(SubEngine &subengine)
     : SimpleConstraintManager(subengine) {}
 
-  const GRState *assumeSymNE(const GRState *state, SymbolRef sym,
+  const ProgramState *assumeSymNE(const ProgramState *state, SymbolRef sym,
                              const llvm::APSInt& Int,
                              const llvm::APSInt& Adjustment);
 
-  const GRState *assumeSymEQ(const GRState *state, SymbolRef sym,
+  const ProgramState *assumeSymEQ(const ProgramState *state, SymbolRef sym,
                              const llvm::APSInt& Int,
                              const llvm::APSInt& Adjustment);
 
-  const GRState *assumeSymLT(const GRState *state, SymbolRef sym,
+  const ProgramState *assumeSymLT(const ProgramState *state, SymbolRef sym,
                              const llvm::APSInt& Int,
                              const llvm::APSInt& Adjustment);
 
-  const GRState *assumeSymGT(const GRState *state, SymbolRef sym,
+  const ProgramState *assumeSymGT(const ProgramState *state, SymbolRef sym,
                              const llvm::APSInt& Int,
                              const llvm::APSInt& Adjustment);
 
-  const GRState *assumeSymGE(const GRState *state, SymbolRef sym,
+  const ProgramState *assumeSymGE(const ProgramState *state, SymbolRef sym,
                              const llvm::APSInt& Int,
                              const llvm::APSInt& Adjustment);
 
-  const GRState *assumeSymLE(const GRState *state, SymbolRef sym,
+  const ProgramState *assumeSymLE(const ProgramState *state, SymbolRef sym,
                              const llvm::APSInt& Int,
                              const llvm::APSInt& Adjustment);
 
-  const llvm::APSInt* getSymVal(const GRState *St, SymbolRef sym) const;
+  const llvm::APSInt* getSymVal(const ProgramState *St, SymbolRef sym) const;
 
   // FIXME: Refactor into SimpleConstraintManager?
-  bool isEqual(const GRState *St, SymbolRef sym, const llvm::APSInt& V) const {
+  bool isEqual(const ProgramState *St, SymbolRef sym, const llvm::APSInt& V) const {
     const llvm::APSInt *i = getSymVal(St, sym);
     return i ? *i == V : false;
   }
 
-  const GRState *removeDeadBindings(const GRState *St, SymbolReaper& SymReaper);
+  const ProgramState *removeDeadBindings(const ProgramState *St, SymbolReaper& SymReaper);
 
-  void print(const GRState *St, raw_ostream &Out,
+  void print(const ProgramState *St, raw_ostream &Out,
              const char* nl, const char *sep);
 
 private:
@@ -253,12 +253,12 @@
 
 } // end anonymous namespace
 
-ConstraintManager* ento::CreateRangeConstraintManager(GRStateManager&,
+ConstraintManager* ento::CreateRangeConstraintManager(ProgramStateManager&,
                                                     SubEngine &subeng) {
   return new RangeConstraintManager(subeng);
 }
 
-const llvm::APSInt* RangeConstraintManager::getSymVal(const GRState *St,
+const llvm::APSInt* RangeConstraintManager::getSymVal(const ProgramState *St,
                                                       SymbolRef sym) const {
   const ConstraintRangeTy::data_type *T = St->get<ConstraintRange>(sym);
   return T ? T->getConcreteValue() : NULL;
@@ -266,8 +266,8 @@
 
 /// Scan all symbols referenced by the constraints. If the symbol is not alive
 /// as marked in LSymbols, mark it as dead in DSymbols.
-const GRState*
-RangeConstraintManager::removeDeadBindings(const GRState *state,
+const ProgramState*
+RangeConstraintManager::removeDeadBindings(const ProgramState *state,
                                            SymbolReaper& SymReaper) {
 
   ConstraintRangeTy CR = state->get<ConstraintRange>();
@@ -283,7 +283,7 @@
 }
 
 RangeSet
-RangeConstraintManager::GetRange(const GRState *state, SymbolRef sym) {
+RangeConstraintManager::GetRange(const ProgramState *state, SymbolRef sym) {
   if (ConstraintRangeTy::data_type* V = state->get<ConstraintRange>(sym))
     return *V;
 
@@ -306,8 +306,8 @@
 // As an example, the range [UINT_MAX-1, 3) contains five values: UINT_MAX-1,
 // UINT_MAX, 0, 1, and 2.
 
-const GRState*
-RangeConstraintManager::assumeSymNE(const GRState *state, SymbolRef sym,
+const ProgramState*
+RangeConstraintManager::assumeSymNE(const ProgramState *state, SymbolRef sym,
                                     const llvm::APSInt& Int,
                                     const llvm::APSInt& Adjustment) {
   BasicValueFactory &BV = state->getBasicVals();
@@ -323,8 +323,8 @@
   return New.isEmpty() ? NULL : state->set<ConstraintRange>(sym, New);
 }
 
-const GRState*
-RangeConstraintManager::assumeSymEQ(const GRState *state, SymbolRef sym,
+const ProgramState*
+RangeConstraintManager::assumeSymEQ(const ProgramState *state, SymbolRef sym,
                                     const llvm::APSInt& Int,
                                     const llvm::APSInt& Adjustment) {
   // [Int-Adjustment, Int-Adjustment]
@@ -334,8 +334,8 @@
   return New.isEmpty() ? NULL : state->set<ConstraintRange>(sym, New);
 }
 
-const GRState*
-RangeConstraintManager::assumeSymLT(const GRState *state, SymbolRef sym,
+const ProgramState*
+RangeConstraintManager::assumeSymLT(const ProgramState *state, SymbolRef sym,
                                     const llvm::APSInt& Int,
                                     const llvm::APSInt& Adjustment) {
   BasicValueFactory &BV = state->getBasicVals();
@@ -355,8 +355,8 @@
   return New.isEmpty() ? NULL : state->set<ConstraintRange>(sym, New);
 }
 
-const GRState*
-RangeConstraintManager::assumeSymGT(const GRState *state, SymbolRef sym,
+const ProgramState*
+RangeConstraintManager::assumeSymGT(const ProgramState *state, SymbolRef sym,
                                     const llvm::APSInt& Int,
                                     const llvm::APSInt& Adjustment) {
   BasicValueFactory &BV = state->getBasicVals();
@@ -376,8 +376,8 @@
   return New.isEmpty() ? NULL : state->set<ConstraintRange>(sym, New);
 }
 
-const GRState*
-RangeConstraintManager::assumeSymGE(const GRState *state, SymbolRef sym,
+const ProgramState*
+RangeConstraintManager::assumeSymGE(const ProgramState *state, SymbolRef sym,
                                     const llvm::APSInt& Int,
                                     const llvm::APSInt& Adjustment) {
   BasicValueFactory &BV = state->getBasicVals();
@@ -398,8 +398,8 @@
   return New.isEmpty() ? NULL : state->set<ConstraintRange>(sym, New);
 }
 
-const GRState*
-RangeConstraintManager::assumeSymLE(const GRState *state, SymbolRef sym,
+const ProgramState*
+RangeConstraintManager::assumeSymLE(const ProgramState *state, SymbolRef sym,
                                     const llvm::APSInt& Int,
                                     const llvm::APSInt& Adjustment) {
   BasicValueFactory &BV = state->getBasicVals();
@@ -424,7 +424,7 @@
 // Pretty-printing.
 //===------------------------------------------------------------------------===/
 
-void RangeConstraintManager::print(const GRState *St, raw_ostream &Out,
+void RangeConstraintManager::print(const ProgramState *St, raw_ostream &Out,
                                    const char* nl, const char *sep) {
 
   ConstraintRangeTy Ranges = St->get<ConstraintRange>();
diff --git a/lib/StaticAnalyzer/Core/RegionStore.cpp b/lib/StaticAnalyzer/Core/RegionStore.cpp
index 3cb40e4..30028c7 100644
--- a/lib/StaticAnalyzer/Core/RegionStore.cpp
+++ b/lib/StaticAnalyzer/Core/RegionStore.cpp
@@ -20,8 +20,8 @@
 #include "clang/Analysis/Analyses/LiveVariables.h"
 #include "clang/Analysis/AnalysisContext.h"
 #include "clang/Basic/TargetInfo.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/GRState.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/GRStateTrait.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h"
 #include "llvm/ADT/ImmutableList.h"
 #include "llvm/ADT/ImmutableMap.h"
@@ -196,7 +196,7 @@
   RegionBindings::Factory RBFactory;
 
 public:
-  RegionStoreManager(GRStateManager& mgr, const RegionStoreFeatures &f)
+  RegionStoreManager(ProgramStateManager& mgr, const RegionStoreFeatures &f)
     : StoreManager(mgr),
       Features(f),
       RBFactory(mgr.getAllocator()) {}
@@ -376,7 +376,7 @@
   StoreRef removeDeadBindings(Store store, const StackFrameContext *LCtx,
                               SymbolReaper& SymReaper);
 
-  StoreRef enterStackFrame(const GRState *state,
+  StoreRef enterStackFrame(const ProgramState *state,
                            const StackFrameContext *frame);
 
   //===------------------------------------------------------------------===//
@@ -384,7 +384,7 @@
   //===------------------------------------------------------------------===//
 
   // FIXME: This method will soon be eliminated; see the note in Store.h.
-  DefinedOrUnknownSVal getSizeInElements(const GRState *state,
+  DefinedOrUnknownSVal getSizeInElements(const ProgramState *state,
                                          const MemRegion* R, QualType EleTy);
 
   //===------------------------------------------------------------------===//
@@ -419,12 +419,12 @@
 // RegionStore creation.
 //===----------------------------------------------------------------------===//
 
-StoreManager *ento::CreateRegionStoreManager(GRStateManager& StMgr) {
+StoreManager *ento::CreateRegionStoreManager(ProgramStateManager& StMgr) {
   RegionStoreFeatures F = maximal_features_tag();
   return new RegionStoreManager(StMgr, F);
 }
 
-StoreManager *ento::CreateFieldsOnlyRegionStoreManager(GRStateManager &StMgr) {
+StoreManager *ento::CreateFieldsOnlyRegionStoreManager(ProgramStateManager &StMgr) {
   RegionStoreFeatures F = minimal_features_tag();
   F.enableFields(true);
   return new RegionStoreManager(StMgr, F);
@@ -480,7 +480,7 @@
   const bool includeGlobals;
 
 public:
-  ClusterAnalysis(RegionStoreManager &rm, GRStateManager &StateMgr,
+  ClusterAnalysis(RegionStoreManager &rm, ProgramStateManager &StateMgr,
                   RegionBindings b, const bool includeGlobals)
     : RM(rm), Ctx(StateMgr.getContext()),
       svalBuilder(StateMgr.getSValBuilder()),
@@ -593,7 +593,7 @@
   StoreManager::InvalidatedRegions *Regions;
 public:
   invalidateRegionsWorker(RegionStoreManager &rm,
-                          GRStateManager &stateMgr,
+                          ProgramStateManager &stateMgr,
                           RegionBindings b,
                           const Expr *ex, unsigned count,
                           StoreManager::InvalidatedSymbols &is,
@@ -766,7 +766,7 @@
 // Extents for regions.
 //===----------------------------------------------------------------------===//
 
-DefinedOrUnknownSVal RegionStoreManager::getSizeInElements(const GRState *state,
+DefinedOrUnknownSVal RegionStoreManager::getSizeInElements(const ProgramState *state,
                                                            const MemRegion *R,
                                                            QualType EleTy) {
   SVal Size = cast<SubRegion>(R)->getExtent(svalBuilder);
@@ -1644,7 +1644,7 @@
   const StackFrameContext *CurrentLCtx;
 
 public:
-  removeDeadBindingsWorker(RegionStoreManager &rm, GRStateManager &stateMgr,
+  removeDeadBindingsWorker(RegionStoreManager &rm, ProgramStateManager &stateMgr,
                            RegionBindings b, SymbolReaper &symReaper,
                            const StackFrameContext *LCtx)
     : ClusterAnalysis<removeDeadBindingsWorker>(rm, stateMgr, b,
@@ -1819,7 +1819,7 @@
 }
 
 
-StoreRef RegionStoreManager::enterStackFrame(const GRState *state,
+StoreRef RegionStoreManager::enterStackFrame(const ProgramState *state,
                                              const StackFrameContext *frame) {
   FunctionDecl const *FD = cast<FunctionDecl>(frame->getDecl());
   FunctionDecl::param_const_iterator PI = FD->param_begin(), 
diff --git a/lib/StaticAnalyzer/Core/SValBuilder.cpp b/lib/StaticAnalyzer/Core/SValBuilder.cpp
index 4fd492e..e17f0be 100644
--- a/lib/StaticAnalyzer/Core/SValBuilder.cpp
+++ b/lib/StaticAnalyzer/Core/SValBuilder.cpp
@@ -15,7 +15,7 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/GRState.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h"
 
 using namespace clang;
@@ -162,7 +162,7 @@
 
 //===----------------------------------------------------------------------===//
 
-SVal SValBuilder::evalBinOp(const GRState *state, BinaryOperator::Opcode op,
+SVal SValBuilder::evalBinOp(const ProgramState *state, BinaryOperator::Opcode op,
                             SVal lhs, SVal rhs, QualType type) {
 
   if (lhs.isUndef() || rhs.isUndef())
@@ -190,7 +190,7 @@
   return evalBinOpNN(state, op, cast<NonLoc>(lhs), cast<NonLoc>(rhs), type);
 }
 
-DefinedOrUnknownSVal SValBuilder::evalEQ(const GRState *state,
+DefinedOrUnknownSVal SValBuilder::evalEQ(const ProgramState *state,
                                          DefinedOrUnknownSVal lhs,
                                          DefinedOrUnknownSVal rhs) {
   return cast<DefinedOrUnknownSVal>(evalBinOp(state, BO_EQ, lhs, rhs,
diff --git a/lib/StaticAnalyzer/Core/SVals.cpp b/lib/StaticAnalyzer/Core/SVals.cpp
index 2f4dca5..8eb65ba 100644
--- a/lib/StaticAnalyzer/Core/SVals.cpp
+++ b/lib/StaticAnalyzer/Core/SVals.cpp
@@ -12,7 +12,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "clang/StaticAnalyzer/Core/PathSensitive/GRState.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
 #include "clang/AST/ExprObjC.h"
 #include "clang/Basic/IdentifierTable.h"
 using namespace clang;
diff --git a/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp b/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp
index 20762e0..73b4d78 100644
--- a/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp
+++ b/lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp
@@ -14,7 +14,7 @@
 
 #include "SimpleConstraintManager.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/GRState.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
 
 namespace clang {
 
@@ -56,7 +56,7 @@
   return true;
 }
 
-const GRState *SimpleConstraintManager::assume(const GRState *state,
+const ProgramState *SimpleConstraintManager::assume(const ProgramState *state,
                                                DefinedSVal Cond,
                                                bool Assumption) {
   if (isa<NonLoc>(Cond))
@@ -65,13 +65,13 @@
     return assume(state, cast<Loc>(Cond), Assumption);
 }
 
-const GRState *SimpleConstraintManager::assume(const GRState *state, Loc cond,
+const ProgramState *SimpleConstraintManager::assume(const ProgramState *state, Loc cond,
                                                bool assumption) {
   state = assumeAux(state, cond, assumption);
   return SU.processAssume(state, cond, assumption);
 }
 
-const GRState *SimpleConstraintManager::assumeAux(const GRState *state,
+const ProgramState *SimpleConstraintManager::assumeAux(const ProgramState *state,
                                                   Loc Cond, bool Assumption) {
 
   BasicValueFactory &BasicVals = state->getBasicVals();
@@ -113,7 +113,7 @@
   } // end switch
 }
 
-const GRState *SimpleConstraintManager::assume(const GRState *state,
+const ProgramState *SimpleConstraintManager::assume(const ProgramState *state,
                                                NonLoc cond,
                                                bool assumption) {
   state = assumeAux(state, cond, assumption);
@@ -135,7 +135,7 @@
   }
 }
 
-const GRState *SimpleConstraintManager::assumeAux(const GRState *state,
+const ProgramState *SimpleConstraintManager::assumeAux(const ProgramState *state,
                                                   NonLoc Cond,
                                                   bool Assumption) {
 
@@ -202,7 +202,7 @@
   } // end switch
 }
 
-const GRState *SimpleConstraintManager::assumeSymRel(const GRState *state,
+const ProgramState *SimpleConstraintManager::assumeSymRel(const ProgramState *state,
                                                      const SymExpr *LHS,
                                                      BinaryOperator::Opcode op,
                                                      const llvm::APSInt& Int) {
@@ -256,7 +256,7 @@
   // be of the same type as the symbol, which is not always correct. Really the
   // comparisons should be performed using the Int's type, then mapped back to
   // the symbol's range of values.
-  GRStateManager &StateMgr = state->getStateManager();
+  ProgramStateManager &StateMgr = state->getStateManager();
   ASTContext &Ctx = StateMgr.getContext();
 
   QualType T = Sym->getType(Ctx);
diff --git a/lib/StaticAnalyzer/Core/SimpleConstraintManager.h b/lib/StaticAnalyzer/Core/SimpleConstraintManager.h
index a2952af..d4295d4 100644
--- a/lib/StaticAnalyzer/Core/SimpleConstraintManager.h
+++ b/lib/StaticAnalyzer/Core/SimpleConstraintManager.h
@@ -15,7 +15,7 @@
 #define LLVM_CLANG_GR_SIMPLE_CONSTRAINT_MANAGER_H
 
 #include "clang/StaticAnalyzer/Core/PathSensitive/ConstraintManager.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/GRState.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
 
 namespace clang {
 
@@ -33,14 +33,14 @@
 
   bool canReasonAbout(SVal X) const;
 
-  const GRState *assume(const GRState *state, DefinedSVal Cond,
+  const ProgramState *assume(const ProgramState *state, DefinedSVal Cond,
                         bool Assumption);
 
-  const GRState *assume(const GRState *state, Loc Cond, bool Assumption);
+  const ProgramState *assume(const ProgramState *state, Loc Cond, bool Assumption);
 
-  const GRState *assume(const GRState *state, NonLoc Cond, bool Assumption);
+  const ProgramState *assume(const ProgramState *state, NonLoc Cond, bool Assumption);
 
-  const GRState *assumeSymRel(const GRState *state,
+  const ProgramState *assumeSymRel(const ProgramState *state,
                               const SymExpr *LHS,
                               BinaryOperator::Opcode op,
                               const llvm::APSInt& Int);
@@ -53,27 +53,27 @@
 
   // Each of these is of the form "$sym+Adj <> V", where "<>" is the comparison
   // operation for the method being invoked.
-  virtual const GRState *assumeSymNE(const GRState *state, SymbolRef sym,
+  virtual const ProgramState *assumeSymNE(const ProgramState *state, SymbolRef sym,
                                      const llvm::APSInt& V,
                                      const llvm::APSInt& Adjustment) = 0;
 
-  virtual const GRState *assumeSymEQ(const GRState *state, SymbolRef sym,
+  virtual const ProgramState *assumeSymEQ(const ProgramState *state, SymbolRef sym,
                                      const llvm::APSInt& V,
                                      const llvm::APSInt& Adjustment) = 0;
 
-  virtual const GRState *assumeSymLT(const GRState *state, SymbolRef sym,
+  virtual const ProgramState *assumeSymLT(const ProgramState *state, SymbolRef sym,
                                      const llvm::APSInt& V,
                                      const llvm::APSInt& Adjustment) = 0;
 
-  virtual const GRState *assumeSymGT(const GRState *state, SymbolRef sym,
+  virtual const ProgramState *assumeSymGT(const ProgramState *state, SymbolRef sym,
                                      const llvm::APSInt& V,
                                      const llvm::APSInt& Adjustment) = 0;
 
-  virtual const GRState *assumeSymLE(const GRState *state, SymbolRef sym,
+  virtual const ProgramState *assumeSymLE(const ProgramState *state, SymbolRef sym,
                                      const llvm::APSInt& V,
                                      const llvm::APSInt& Adjustment) = 0;
 
-  virtual const GRState *assumeSymGE(const GRState *state, SymbolRef sym,
+  virtual const ProgramState *assumeSymGE(const ProgramState *state, SymbolRef sym,
                                      const llvm::APSInt& V,
                                      const llvm::APSInt& Adjustment) = 0;
 
@@ -81,9 +81,9 @@
   // Internal implementation.
   //===------------------------------------------------------------------===//
 
-  const GRState *assumeAux(const GRState *state, Loc Cond,bool Assumption);
+  const ProgramState *assumeAux(const ProgramState *state, Loc Cond,bool Assumption);
 
-  const GRState *assumeAux(const GRState *state, NonLoc Cond, bool Assumption);
+  const ProgramState *assumeAux(const ProgramState *state, NonLoc Cond, bool Assumption);
 };
 
 } // end GR namespace
diff --git a/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp b/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
index 80c18a3..787aa05 100644
--- a/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
+++ b/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
@@ -12,7 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/GRState.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
 
 using namespace clang;
 using namespace ento;
@@ -25,22 +25,22 @@
 
 public:
   SimpleSValBuilder(llvm::BumpPtrAllocator &alloc, ASTContext &context,
-                    GRStateManager &stateMgr)
+                    ProgramStateManager &stateMgr)
                     : SValBuilder(alloc, context, stateMgr) {}
   virtual ~SimpleSValBuilder() {}
 
   virtual SVal evalMinus(NonLoc val);
   virtual SVal evalComplement(NonLoc val);
-  virtual SVal evalBinOpNN(const GRState *state, BinaryOperator::Opcode op,
+  virtual SVal evalBinOpNN(const ProgramState *state, BinaryOperator::Opcode op,
                            NonLoc lhs, NonLoc rhs, QualType resultTy);
-  virtual SVal evalBinOpLL(const GRState *state, BinaryOperator::Opcode op,
+  virtual SVal evalBinOpLL(const ProgramState *state, BinaryOperator::Opcode op,
                            Loc lhs, Loc rhs, QualType resultTy);
-  virtual SVal evalBinOpLN(const GRState *state, BinaryOperator::Opcode op,
+  virtual SVal evalBinOpLN(const ProgramState *state, BinaryOperator::Opcode op,
                            Loc lhs, NonLoc rhs, QualType resultTy);
 
   /// getKnownValue - evaluates a given SVal. If the SVal has only one possible
   ///  (integer) value, that value is returned. Otherwise, returns NULL.
-  virtual const llvm::APSInt *getKnownValue(const GRState *state, SVal V);
+  virtual const llvm::APSInt *getKnownValue(const ProgramState *state, SVal V);
   
   SVal MakeSymIntVal(const SymExpr *LHS, BinaryOperator::Opcode op,
                      const llvm::APSInt &RHS, QualType resultTy);
@@ -49,7 +49,7 @@
 
 SValBuilder *ento::createSimpleSValBuilder(llvm::BumpPtrAllocator &alloc,
                                            ASTContext &context,
-                                           GRStateManager &stateMgr) {
+                                           ProgramStateManager &stateMgr) {
   return new SimpleSValBuilder(alloc, context, stateMgr);
 }
 
@@ -270,7 +270,7 @@
   return makeNonLoc(LHS, op, RHS, resultTy);
 }
 
-SVal SimpleSValBuilder::evalBinOpNN(const GRState *state,
+SVal SimpleSValBuilder::evalBinOpNN(const ProgramState *state,
                                   BinaryOperator::Opcode op,
                                   NonLoc lhs, NonLoc rhs,
                                   QualType resultTy)  {
@@ -539,7 +539,7 @@
 }
 
 // FIXME: all this logic will change if/when we have MemRegion::getLocation().
-SVal SimpleSValBuilder::evalBinOpLL(const GRState *state,
+SVal SimpleSValBuilder::evalBinOpLL(const ProgramState *state,
                                   BinaryOperator::Opcode op,
                                   Loc lhs, Loc rhs,
                                   QualType resultTy) {
@@ -836,7 +836,7 @@
   }
 }
 
-SVal SimpleSValBuilder::evalBinOpLN(const GRState *state,
+SVal SimpleSValBuilder::evalBinOpLN(const ProgramState *state,
                                   BinaryOperator::Opcode op,
                                   Loc lhs, NonLoc rhs, QualType resultTy) {
   
@@ -930,7 +930,7 @@
   return UnknownVal();  
 }
 
-const llvm::APSInt *SimpleSValBuilder::getKnownValue(const GRState *state,
+const llvm::APSInt *SimpleSValBuilder::getKnownValue(const ProgramState *state,
                                                    SVal V) {
   if (V.isUnknownOrUndef())
     return NULL;
diff --git a/lib/StaticAnalyzer/Core/Store.cpp b/lib/StaticAnalyzer/Core/Store.cpp
index 92dd8ed..127d583 100644
--- a/lib/StaticAnalyzer/Core/Store.cpp
+++ b/lib/StaticAnalyzer/Core/Store.cpp
@@ -12,17 +12,17 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/StaticAnalyzer/Core/PathSensitive/Store.h"
-#include "clang/StaticAnalyzer/Core/PathSensitive/GRState.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
 #include "clang/AST/CharUnits.h"
 
 using namespace clang;
 using namespace ento;
 
-StoreManager::StoreManager(GRStateManager &stateMgr)
+StoreManager::StoreManager(ProgramStateManager &stateMgr)
   : svalBuilder(stateMgr.getSValBuilder()), StateMgr(stateMgr),
     MRMgr(svalBuilder.getRegionManager()), Ctx(stateMgr.getContext()) {}
 
-StoreRef StoreManager::enterStackFrame(const GRState *state,
+StoreRef StoreManager::enterStackFrame(const ProgramState *state,
                                        const StackFrameContext *frame) {
   return StoreRef(state->getStore(), *this);
 }