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
diff --git a/lib/Analysis/GRState.cpp b/lib/Analysis/GRState.cpp
index 1c7df79..b945803 100644
--- a/lib/Analysis/GRState.cpp
+++ b/lib/Analysis/GRState.cpp
@@ -178,11 +178,9 @@
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 @@
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.