Index: include/clang/Checker/PathSensitive/GRState.h
===================================================================
--- include/clang/Checker/PathSensitive/GRState.h	(revision 116923)
+++ include/clang/Checker/PathSensitive/GRState.h	(working copy)
@@ -409,7 +409,7 @@
   friend class GRExprEngine; // FIXME: Remove.
 private:
   /// Eng - The GRSubEngine that owns this state manager.
-  GRSubEngine &Eng;
+  GRSubEngine *Eng;
 
   EnvironmentManager                   EnvMgr;
   llvm::OwningPtr<StoreManager>        StoreMgr;
@@ -439,8 +439,8 @@
                  StoreManagerCreator CreateStoreManager,
                  ConstraintManagerCreator CreateConstraintManager,
                  llvm::BumpPtrAllocator& alloc,
-                 GRSubEngine &subeng)
-    : Eng(subeng),
+                 GRSubEngine& subeng)
+    : Eng(&subeng),
       EnvMgr(alloc),
       GDMFactory(alloc),
       ValueMgr(alloc, Ctx, *this),
@@ -449,6 +449,19 @@
     ConstraintMgr.reset((*CreateConstraintManager)(*this, subeng));
   }
 
+  GRStateManager(ASTContext& Ctx,
+                 StoreManager* pStoreManager,
+                 ConstraintManager* pConstraintManager,
+                 llvm::BumpPtrAllocator& alloc)
+    : Eng(0),
+      EnvMgr(alloc),
+      GDMFactory(alloc),
+      ValueMgr(alloc, Ctx, *this),
+      Alloc(alloc) {
+    StoreMgr.reset(pStoreManager);
+    ConstraintMgr.reset(pConstraintManager);
+  }
+
   ~GRStateManager();
 
   const GRState *getInitialState(const LocationContext *InitLoc);
@@ -484,7 +497,7 @@
 
   StoreManager& getStoreManager() { return *StoreMgr; }
   ConstraintManager& getConstraintManager() { return *ConstraintMgr; }
-  GRSubEngine& getOwningEngine() { return Eng; }
+  GRSubEngine* getOwningEngine() { return Eng; }
 
   const GRState* RemoveDeadBindings(const GRState* St,
                                     const StackFrameContext *LCtx,
Index: lib/Checker/GRState.cpp
===================================================================
--- lib/Checker/GRState.cpp	(revision 116923)
+++ lib/Checker/GRState.cpp	(working copy)
@@ -93,8 +93,8 @@
   const GRState *new_state = makeWithStore(new_store);
 
   const MemRegion *MR = LV.getAsRegion();
-  if (MR)
-    return Mgr.getOwningEngine().ProcessRegionChange(new_state, MR);
+  if (MR && Mgr.getOwningEngine())
+    return Mgr.getOwningEngine()->ProcessRegionChange(new_state, MR);
 
   return new_state;
 }
@@ -104,7 +104,9 @@
   const MemRegion *R = cast<loc::MemRegionVal>(loc).getRegion();
   Store new_store = Mgr.StoreMgr->BindDefault(St, R, V);
   const GRState *new_state = makeWithStore(new_store);
-  return Mgr.getOwningEngine().ProcessRegionChange(new_state, R);
+  return Mgr.getOwningEngine() ? 
+           Mgr.getOwningEngine()->ProcessRegionChange(new_state, R) : 
+           new_state;
 }
 
 const GRState *GRState::InvalidateRegions(const MemRegion * const *Begin,
@@ -113,9 +115,9 @@
                                           StoreManager::InvalidatedSymbols *IS,
                                           bool invalidateGlobals) const {
   GRStateManager &Mgr = getStateManager();
-  GRSubEngine &Eng = Mgr.getOwningEngine();
+  GRSubEngine* Eng = Mgr.getOwningEngine();
 
-  if (Eng.WantsRegionChangeUpdate(this)) {
+  if (Eng && Eng->WantsRegionChangeUpdate(this)) {
     StoreManager::InvalidatedRegions Regions;
 
     Store new_store = Mgr.StoreMgr->InvalidateRegions(St, Begin, End,
@@ -124,9 +126,9 @@
                                                       &Regions);
     const GRState *new_state = makeWithStore(new_store);
 
-    return Eng.ProcessRegionChanges(new_state,
-                                    &Regions.front(),
-                                    &Regions.back()+1);
+    return Eng->ProcessRegionChanges(new_state,
+                                     &Regions.front(),
+                                     &Regions.back()+1);
   }
 
   Store new_store = Mgr.StoreMgr->InvalidateRegions(St, Begin, End,
