diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-08-14 21:16:54 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-08-14 21:16:54 +0000 |
commit | 72cd17f0a4722e1fa3eb47c08a7aa29aeba16754 (patch) | |
tree | 70943c109a1aae572f700ece461d26a2b4fae6a9 /lib/Analysis/GRState.cpp | |
parent | faf37e7d3646c4f473e7a565a9a2f8baed62dbe6 (diff) |
Migrated retain/release checker to use the Generic Data Map in GRState (instead
of using CheckerState).
Removed CheckerState from GRState.
Added class GRStateRef which wraps GRState* and GRStateManager*. This is handy
for generating new states with a single handle.
Added member template set/get functions to GRStateRef/GRState/GRStateManager for
accessing the Generic Data Map.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54788 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/GRState.cpp')
-rw-r--r-- | lib/Analysis/GRState.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/lib/Analysis/GRState.cpp b/lib/Analysis/GRState.cpp index 1c7df79c02..b945803804 100644 --- a/lib/Analysis/GRState.cpp +++ b/lib/Analysis/GRState.cpp @@ -178,11 +178,9 @@ const GRState* GRStateManager::AddEQ(const GRState* St, SymbolID sym, const GRState* GRStateManager::getInitialState() { - GRState StateImpl(EnvMgr.getInitialEnvironment(), - StMgr->getInitialStore(), - GDMFactory.GetEmptyMap(), - CNEFactory.GetEmptyMap(), - CEFactory.GetEmptyMap()); + GRState StateImpl(EnvMgr.getInitialEnvironment(), StMgr->getInitialStore(), + GDMFactory.GetEmptyMap(), CNEFactory.GetEmptyMap(), + CEFactory.GetEmptyMap()); return getPersistentState(StateImpl); } @@ -307,6 +305,25 @@ void GRState::print(std::ostream& Out, Printer** Beg, Printer** End, for ( ; Beg != End ; ++Beg) (*Beg)->Print(Out, this, nl, sep); } +//===----------------------------------------------------------------------===// +// Generic Data Map. +//===----------------------------------------------------------------------===// + +void* const* GRState::FindGDM(void* K) const { + return GDM.lookup(K); +} + +const GRState* GRStateManager::addGDM(const GRState* St, void* Key, void* Data){ + GRState::GenericDataMap M1 = St->getGDM(); + GRState::GenericDataMap M2 = GDMFactory.Add(M1, Key, Data); + + if (M1 == M2) + return St; + + GRState NewSt = *St; + NewSt.GDM = M2; + return getPersistentState(NewSt); +} //===----------------------------------------------------------------------===// // Queries. |