From cee28a4c4dd944d11a3336ab8ff782879adde3d0 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Sun, 2 Aug 2009 04:45:08 +0000 Subject: Generalize the interface of 'StoreManager::RemoveDeadBindings()' to manipulate the entire GRState, not just the Store. llvm-svn: 77870 --- clang/lib/Analysis/BasicStore.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'clang/lib/Analysis/BasicStore.cpp') diff --git a/clang/lib/Analysis/BasicStore.cpp b/clang/lib/Analysis/BasicStore.cpp index 2b70a964267..b044d400ae7 100644 --- a/clang/lib/Analysis/BasicStore.cpp +++ b/clang/lib/Analysis/BasicStore.cpp @@ -93,10 +93,9 @@ public: const MemRegion* getSelfRegion(Store) { return SelfRegion; } /// RemoveDeadBindings - Scans a BasicStore of 'state' for dead values. - /// It returns a new Store with these values removed. - Store RemoveDeadBindings(const GRState *state, Stmt* Loc, - SymbolReaper& SymReaper, - llvm::SmallVectorImpl& RegionRoots); + /// It updatees the GRState object in place with the values removed. + void RemoveDeadBindings(GRState &state, Stmt* Loc, SymbolReaper& SymReaper, + llvm::SmallVectorImpl& RegionRoots); void iterBindings(Store store, BindingsHandler& f); @@ -379,13 +378,12 @@ Store BasicStoreManager::Remove(Store store, Loc loc) { } } -Store -BasicStoreManager::RemoveDeadBindings(const GRState *state, Stmt* Loc, +void +BasicStoreManager::RemoveDeadBindings(GRState &state, Stmt* Loc, SymbolReaper& SymReaper, - llvm::SmallVectorImpl& RegionRoots) -{ - - Store store = state->getStore(); + llvm::SmallVectorImpl& RegionRoots) +{ + Store store = state.getStore(); BindingsTy B = GetBindings(store); typedef SVal::symbol_iterator symbol_iterator; @@ -426,7 +424,7 @@ BasicStoreManager::RemoveDeadBindings(const GRState *state, Stmt* Loc, break; Marked.insert(MR); - SVal X = Retrieve(state, loc::MemRegionVal(MR)).getSVal(); + SVal X = Retrieve(&state, loc::MemRegionVal(MR)).getSVal(); // FIXME: We need to handle symbols nested in region definitions. for (symbol_iterator SI=X.symbol_begin(),SE=X.symbol_end();SI!=SE;++SI) @@ -459,7 +457,8 @@ BasicStoreManager::RemoveDeadBindings(const GRState *state, Stmt* Loc, } } - return store; + // Write the store back. + state.setStore(store); } Store BasicStoreManager::scanForIvars(Stmt *B, const Decl* SelfDecl, Store St) { -- cgit v1.2.3