aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/RegionStore.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-12-05 00:47:52 +0000
committerTed Kremenek <kremenek@apple.com>2008-12-05 00:47:52 +0000
commit2ed14beed7dcb46245328d72ac7011c92c1bd676 (patch)
tree648920a505945b17474cd79c77d0c3527eca7fef /lib/Analysis/RegionStore.cpp
parent802db9b4d5fba62890447bea39d637896a920e44 (diff)
StoreManager::Retrieve and StoreManager::RemoveDeadBindings now take a GRState* argument instead of a Store. This allows them to use the GDM for storing other data.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60570 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/RegionStore.cpp')
-rw-r--r--lib/Analysis/RegionStore.cpp36
1 files changed, 17 insertions, 19 deletions
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp
index f2410643fd..07399f41ef 100644
--- a/lib/Analysis/RegionStore.cpp
+++ b/lib/Analysis/RegionStore.cpp
@@ -53,12 +53,12 @@ template<> struct GRStateTrait<RegionExtentsTy>
}
// KillSet GDM stuff.
-typedef llvm::ImmutableSet<const MemRegion*> RegionKillSetTy;
-static int RegionKillSetTyIndex = 0;
+typedef llvm::ImmutableSet<const MemRegion*> RegionKills;
+static int RegionKillsIndex = 0;
namespace clang {
- template<> struct GRStateTrait<RegionKillSetTy>
- : public GRStatePartialTrait<RegionKillSetTy> {
- static void* GDMIndex() { return &RegionKillSetTyIndex; }
+ template<> struct GRStateTrait<RegionKills>
+ : public GRStatePartialTrait<RegionKills> {
+ static void* GDMIndex() { return &RegionKillsIndex; }
};
}
@@ -82,11 +82,6 @@ public:
virtual ~RegionStoreManager() {}
MemRegionManager& getRegionManager() { return MRMgr; }
-
- // FIXME: Is this function necessary?
- SVal GetRegionSVal(Store St, const MemRegion* R) {
- return Retrieve(St, loc::MemRegionVal(R));
- }
Store BindCompoundLiteral(Store store, const CompoundLiteralExpr* CL, SVal V);
@@ -109,7 +104,7 @@ public:
std::pair<const GRState*, SVal>
CastRegion(const GRState* St, SVal VoidPtr, QualType CastToTy, Stmt* CastE);
- SVal Retrieve(Store S, Loc L, QualType T = QualType());
+ SVal Retrieve(const GRState* state, Loc L, QualType T = QualType());
Store Bind(Store St, Loc LV, SVal V);
@@ -128,13 +123,14 @@ public:
return 0;
}
- /// RemoveDeadBindings - Scans a RegionStore for dead values. It returns
- /// a new Store with these values removed, and populates LSymbols and
- /// DSymbols with the known set of live and dead symbols respectively.
- Store RemoveDeadBindings(Store store, Stmt* Loc, const LiveVariables& Live,
+ /// RemoveDeadBindings - Scans the RegionStore of 'state' for dead values.
+ /// It returns a new Store with these values removed, and populates LSymbols
+ // and DSymbols with the known set of live and dead symbols respectively.
+ Store RemoveDeadBindings(const GRState* state, Stmt* Loc,
+ const LiveVariables& Live,
llvm::SmallVectorImpl<const MemRegion*>& RegionRoots,
LiveSymbolsTy& LSymbols, DeadSymbolsTy& DSymbols);
-
+
void UpdateLiveSymbols(SVal X, LiveSymbolsTy& LSymbols);
Store BindDecl(Store store, const VarDecl* VD, SVal* InitVal, unsigned Count);
@@ -142,7 +138,7 @@ public:
const GRState* setExtent(const GRState* St, const MemRegion* R, SVal Extent);
static inline RegionBindingsTy GetRegionBindings(Store store) {
- return RegionBindingsTy(static_cast<const RegionBindingsTy::TreeTy*>(store));
+ return RegionBindingsTy(static_cast<const RegionBindingsTy::TreeTy*>(store));
}
void print(Store store, std::ostream& Out, const char* nl, const char *sep);
@@ -393,9 +389,10 @@ RegionStoreManager::CastRegion(const GRState* St, SVal VoidPtr,
return std::make_pair(St, UnknownVal());
}
-SVal RegionStoreManager::Retrieve(Store S, Loc L, QualType T) {
+SVal RegionStoreManager::Retrieve(const GRState* state, Loc L, QualType T) {
assert(!isa<UnknownVal>(L) && "location unknown");
assert(!isa<UndefinedVal>(L) && "location undefined");
+ Store S = state->getStore();
switch (L.getSubKind()) {
case loc::MemRegionKind: {
@@ -626,11 +623,12 @@ void RegionStoreManager::UpdateLiveSymbols(SVal X, LiveSymbolsTy& LSymbols) {
LSymbols.insert(*SI);
}
-Store RegionStoreManager::RemoveDeadBindings(Store store, Stmt* Loc,
+Store RegionStoreManager::RemoveDeadBindings(const GRState* state, Stmt* Loc,
const LiveVariables& Live,
llvm::SmallVectorImpl<const MemRegion*>& RegionRoots,
LiveSymbolsTy& LSymbols, DeadSymbolsTy& DSymbols) {
+ Store store = state->getStore();
RegionBindingsTy B = GetRegionBindings(store);
// Lazily constructed backmap from MemRegions to SubRegions.