diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-02-19 03:56:19 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-02-19 03:56:19 +0000 |
commit | 09fe4a55248bd28a950ec4ba19900e5892be42f6 (patch) | |
tree | 4ff146b00601293e8c50fb4042db2be5ece7f13e /lib/StaticAnalyzer/Core/GRState.cpp | |
parent | d40baf6a77f6353a93f181da5d1347d3730aad37 (diff) |
Change 'StoreRef' back to 'Store' in GRState, shrinking the size of GRState back by one pointer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126020 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/GRState.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/GRState.cpp | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/lib/StaticAnalyzer/Core/GRState.cpp b/lib/StaticAnalyzer/Core/GRState.cpp index 7defecb366..7b216775b8 100644 --- a/lib/StaticAnalyzer/Core/GRState.cpp +++ b/lib/StaticAnalyzer/Core/GRState.cpp @@ -25,6 +25,31 @@ using namespace ento; // FIXME: Move this elsewhere. ConstraintManager::~ConstraintManager() {} +GRState::GRState(GRStateManager *mgr, const Environment& env, + StoreRef st, GenericDataMap gdm) + : stateMgr(mgr), + Env(env), + store(st.getStore()), + GDM(gdm), + refCount(0) { + stateMgr->getStoreManager().incrementReferenceCount(store); +} + +GRState::GRState(const GRState& RHS) + : llvm::FoldingSetNode(), + stateMgr(RHS.stateMgr), + Env(RHS.Env), + store(RHS.store), + GDM(RHS.GDM), + refCount(0) { + stateMgr->getStoreManager().incrementReferenceCount(store); +} + +GRState::~GRState() { + if (store) + stateMgr->getStoreManager().decrementReferenceCount(store); +} + GRStateManager::~GRStateManager() { for (std::vector<GRState::Printer*>::iterator I=Printers.begin(), E=Printers.end(); I!=E; ++I) @@ -53,8 +78,8 @@ GRStateManager::removeDeadBindings(const GRState* state, state, RegionRoots); // Clean up the store. - NewState.St = StoreMgr->removeDeadBindings(NewState.getStore(), LCtx, - SymReaper, RegionRoots); + NewState.setStore(StoreMgr->removeDeadBindings(NewState.getStore(), LCtx, + SymReaper, RegionRoots)); state = getPersistentState(NewState); return ConstraintMgr->removeDeadBindings(state, SymReaper); } @@ -323,10 +348,19 @@ const GRState* GRStateManager::getPersistentState(GRState& State) { const GRState* GRState::makeWithStore(const StoreRef &store) const { GRState NewSt = *this; - NewSt.St = store; + NewSt.setStore(store); return getStateManager().getPersistentState(NewSt); } +void GRState::setStore(const StoreRef &newStore) { + Store newStoreStore = newStore.getStore(); + if (newStoreStore) + stateMgr->getStoreManager().incrementReferenceCount(newStoreStore); + if (store) + stateMgr->getStoreManager().decrementReferenceCount(store); + store = newStoreStore; +} + //===----------------------------------------------------------------------===// // State pretty-printing. //===----------------------------------------------------------------------===// |