diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Checker/BasicStore.cpp | 8 | ||||
-rw-r--r-- | lib/Checker/FlatStore.cpp | 4 | ||||
-rw-r--r-- | lib/Checker/GRState.cpp | 7 | ||||
-rw-r--r-- | lib/Checker/RegionStore.cpp | 22 |
4 files changed, 25 insertions, 16 deletions
diff --git a/lib/Checker/BasicStore.cpp b/lib/Checker/BasicStore.cpp index 34470af29f..5be5ca615e 100644 --- a/lib/Checker/BasicStore.cpp +++ b/lib/Checker/BasicStore.cpp @@ -72,7 +72,7 @@ public: /// 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); @@ -251,11 +251,12 @@ Store BasicStoreManager::Remove(Store store, Loc loc) { } } -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; @@ -329,7 +330,8 @@ Store BasicStoreManager::RemoveDeadBindings(Store store, Stmt* Loc, } } - return store; + state.setStore(store); + return StateMgr.getPersistentState(state); } Store BasicStoreManager::scanForIvars(Stmt *B, const Decl* SelfDecl, diff --git a/lib/Checker/FlatStore.cpp b/lib/Checker/FlatStore.cpp index 2af9ffa4a4..7f1c579c6e 100644 --- a/lib/Checker/FlatStore.cpp +++ b/lib/Checker/FlatStore.cpp @@ -44,11 +44,11 @@ public: } 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); diff --git a/lib/Checker/GRState.cpp b/lib/Checker/GRState.cpp index f68e10b0cb..b16e922776 100644 --- a/lib/Checker/GRState.cpp +++ b/lib/Checker/GRState.cpp @@ -51,11 +51,10 @@ GRStateManager::RemoveDeadBindings(const GRState* state, Stmt* Loc, 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 { diff --git a/lib/Checker/RegionStore.cpp b/lib/Checker/RegionStore.cpp index 0e4c4439f3..f0b61a4ba3 100644 --- a/lib/Checker/RegionStore.cpp +++ b/lib/Checker/RegionStore.cpp @@ -352,9 +352,9 @@ public: // Part of public interface to class. /// 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, @@ -1822,12 +1822,12 @@ bool RemoveDeadBindingsWorker::UpdatePostponed() { 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(); @@ -1860,8 +1860,16 @@ Store RegionStoreManager::RemoveDeadBindings(Store store, Stmt* Loc, 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; } |