friend class ExprEngine; // FIXME: Remove.
private:
/// Eng - The SubEngine that owns this state manager.
- SubEngine &Eng;
+ SubEngine *Eng; /* Can be null. */
EnvironmentManager EnvMgr;
llvm::OwningPtr<StoreManager> StoreMgr;
ConstraintManagerCreator CreateConstraintManager,
llvm::BumpPtrAllocator& alloc,
SubEngine &subeng)
- : Eng(subeng),
+ : Eng(&subeng),
EnvMgr(alloc),
GDMFactory(alloc),
svalBuilder(createSimpleSValBuilder(alloc, Ctx, *this)),
ConstraintMgr.reset((*CreateConstraintManager)(*this, subeng));
}
+ GRStateManager(ASTContext& Ctx,
+ StoreManagerCreator CreateStoreManager,
+ ConstraintManager* ConstraintManagerPtr,
+ llvm::BumpPtrAllocator& alloc)
+ : Eng(0),
+ EnvMgr(alloc),
+ GDMFactory(alloc),
+ svalBuilder(createSimpleSValBuilder(alloc, Ctx, *this)),
+ Alloc(alloc) {
+ StoreMgr.reset((*CreateStoreManager)(*this));
+ ConstraintMgr.reset(ConstraintManagerPtr);
+ }
+
~GRStateManager();
const GRState *getInitialState(const LocationContext *InitLoc);
StoreManager& getStoreManager() { return *StoreMgr; }
ConstraintManager& getConstraintManager() { return *ConstraintMgr; }
- SubEngine& getOwningEngine() { return Eng; }
+ SubEngine* getOwningEngine() { return Eng; }
const GRState* removeDeadBindings(const GRState* St,
const StackFrameContext *LCtx,
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;
}
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,
StoreManager::InvalidatedSymbols *IS,
bool invalidateGlobals) const {
GRStateManager &Mgr = getStateManager();
- SubEngine &Eng = Mgr.getOwningEngine();
-
- if (Eng.wantsRegionChangeUpdate(this)) {
+ SubEngine* Eng = Mgr.getOwningEngine();
+
+ if (Eng && Eng->wantsRegionChangeUpdate(this)) {
StoreManager::InvalidatedRegions Regions;
Store new_store = Mgr.StoreMgr->InvalidateRegions(St, Begin, End,
&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,