return UnknownVal();
}
- virtual Store RemoveDeadBindings(Store store, Stmt* Loc,
- const StackFrameContext *LCtx,
- SymbolReaper& SymReaper,
+ virtual const GRState *RemoveDeadBindings(GRState &state, Stmt* Loc,
+ const StackFrameContext *LCtx,
+ SymbolReaper& SymReaper,
llvm::SmallVectorImpl<const MemRegion*>& RegionRoots) = 0;
virtual Store BindDecl(Store store, const VarRegion *VR, SVal initVal) = 0;
/// RemoveDeadBindings - Scans a BasicStore of 'state' for dead values.
/// It updatees the GRState object in place with the values removed.
- Store RemoveDeadBindings(Store store, Stmt* Loc,
+ const GRState *RemoveDeadBindings(GRState &state, Stmt* Loc,
const StackFrameContext *LCtx,
SymbolReaper& SymReaper,
llvm::SmallVectorImpl<const MemRegion*>& RegionRoots);
}
}
-Store BasicStoreManager::RemoveDeadBindings(Store store, Stmt* Loc,
+const GRState *BasicStoreManager::RemoveDeadBindings(GRState &state, Stmt* Loc,
const StackFrameContext *LCtx,
SymbolReaper& SymReaper,
llvm::SmallVectorImpl<const MemRegion*>& RegionRoots)
{
+ Store store = state.getStore();
BindingsTy B = GetBindings(store);
typedef SVal::symbol_iterator symbol_iterator;
}
}
- return store;
+ state.setStore(store);
+ return StateMgr.getPersistentState(state);
}
Store BasicStoreManager::scanForIvars(Stmt *B, const Decl* SelfDecl,
}
SVal ArrayToPointer(Loc Array);
- Store RemoveDeadBindings(Store store, Stmt* Loc,
+ const GRState *RemoveDeadBindings(GRState &state, Stmt* Loc,
const StackFrameContext *LCtx,
SymbolReaper& SymReaper,
llvm::SmallVectorImpl<const MemRegion*>& RegionRoots){
- return store;
+ return StateMgr.getPersistentState(state);
}
Store BindDecl(Store store, const VarRegion *VR, SVal initVal);
state, RegionRoots);
// Clean up the store.
- NewState.St = StoreMgr->RemoveDeadBindings(NewState.St, Loc, LCtx, SymReaper,
- RegionRoots);
+ const GRState *s = StoreMgr->RemoveDeadBindings(NewState, Loc, LCtx,
+ SymReaper, RegionRoots);
- return ConstraintMgr->RemoveDeadBindings(getPersistentState(NewState),
- SymReaper);
+ return ConstraintMgr->RemoveDeadBindings(s, SymReaper);
}
const GRState *GRState::unbindLoc(Loc LV) const {
/// RemoveDeadBindings - Scans the RegionStore of 'state' for dead values.
/// It returns a new Store with these values removed.
- Store RemoveDeadBindings(Store store, Stmt* Loc,
- const StackFrameContext *LCtx,
- SymbolReaper& SymReaper,
+ const GRState *RemoveDeadBindings(GRState &state, Stmt* Loc,
+ const StackFrameContext *LCtx,
+ SymbolReaper& SymReaper,
llvm::SmallVectorImpl<const MemRegion*>& RegionRoots);
const GRState *EnterStackFrame(const GRState *state,
return changed;
}
-Store RegionStoreManager::RemoveDeadBindings(Store store, Stmt* Loc,
+const GRState *RegionStoreManager::RemoveDeadBindings(GRState &state, Stmt* Loc,
const StackFrameContext *LCtx,
SymbolReaper& SymReaper,
llvm::SmallVectorImpl<const MemRegion*>& RegionRoots)
{
- RegionBindings B = GetRegionBindings(store);
+ RegionBindings B = GetRegionBindings(state.getStore());
RemoveDeadBindingsWorker W(*this, StateMgr, B, SymReaper, Loc, LCtx);
W.GenerateClusters();
for (; SI != SE; ++SI)
SymReaper.maybeDead(*SI);
}
-
- return B.getRoot();
+ state.setStore(B.getRoot());
+ const GRState *s = StateMgr.getPersistentState(state);
+ // Remove the extents of dead symbolic regions.
+ llvm::ImmutableMap<const MemRegion*,SVal> Extents =state.get<RegionExtents>();
+ for (llvm::ImmutableMap<const MemRegion *, SVal>::iterator I=Extents.begin(),
+ E = Extents.end(); I != E; ++I) {
+ if (!W.isVisited(I->first))
+ s = s->remove<RegionExtents>(I->first);
+ }
+ return s;
}