forked from OSchip/llvm-project
parent
2f340d6cb6
commit
1fe63ac93d
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
using namespace clang;
|
using namespace clang;
|
||||||
|
|
||||||
typedef llvm::ImmutableMap<const MemRegion*,SVal> VarBindingsTy;
|
typedef llvm::ImmutableMap<const MemRegion*,SVal> BindingsTy;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
class VISIBILITY_HIDDEN BasicStoreManager : public StoreManager {
|
class VISIBILITY_HIDDEN BasicStoreManager : public StoreManager {
|
||||||
VarBindingsTy::Factory VBFactory;
|
BindingsTy::Factory VBFactory;
|
||||||
GRStateManager& StateMgr;
|
GRStateManager& StateMgr;
|
||||||
const MemRegion* SelfRegion;
|
const MemRegion* SelfRegion;
|
||||||
|
|
||||||
|
@ -123,8 +123,8 @@ public:
|
||||||
|
|
||||||
Store BindDeclInternal(Store store, const VarDecl* VD, SVal* InitVal);
|
Store BindDeclInternal(Store store, const VarDecl* VD, SVal* InitVal);
|
||||||
|
|
||||||
static inline VarBindingsTy GetVarBindings(Store store) {
|
static inline BindingsTy GetBindings(Store store) {
|
||||||
return VarBindingsTy(static_cast<const VarBindingsTy::TreeTy*>(store));
|
return BindingsTy(static_cast<const BindingsTy::TreeTy*>(store));
|
||||||
}
|
}
|
||||||
|
|
||||||
void print(Store store, std::ostream& Out, const char* nl, const char *sep);
|
void print(Store store, std::ostream& Out, const char* nl, const char *sep);
|
||||||
|
@ -306,8 +306,8 @@ SVal BasicStoreManager::Retrieve(const GRState* state, Loc loc, QualType T) {
|
||||||
return UnknownVal();
|
return UnknownVal();
|
||||||
|
|
||||||
Store store = state->getStore();
|
Store store = state->getStore();
|
||||||
VarBindingsTy B = GetVarBindings(store);
|
BindingsTy B = GetBindings(store);
|
||||||
VarBindingsTy::data_type* T = B.lookup(R);
|
BindingsTy::data_type* T = B.lookup(R);
|
||||||
return T ? *T : UnknownVal();
|
return T ? *T : UnknownVal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,7 +339,7 @@ Store BasicStoreManager::BindInternal(Store store, Loc loc, SVal V) {
|
||||||
if (!R)
|
if (!R)
|
||||||
return store;
|
return store;
|
||||||
|
|
||||||
VarBindingsTy B = GetVarBindings(store);
|
BindingsTy B = GetBindings(store);
|
||||||
return V.isUnknown()
|
return V.isUnknown()
|
||||||
? VBFactory.Remove(B, R).getRoot()
|
? VBFactory.Remove(B, R).getRoot()
|
||||||
: VBFactory.Add(B, R, V).getRoot();
|
: VBFactory.Add(B, R, V).getRoot();
|
||||||
|
@ -359,7 +359,7 @@ Store BasicStoreManager::Remove(Store store, Loc loc) {
|
||||||
if (!R)
|
if (!R)
|
||||||
return store;
|
return store;
|
||||||
|
|
||||||
VarBindingsTy B = GetVarBindings(store);
|
BindingsTy B = GetBindings(store);
|
||||||
return VBFactory.Remove(B, R).getRoot();
|
return VBFactory.Remove(B, R).getRoot();
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -375,11 +375,11 @@ BasicStoreManager::RemoveDeadBindings(const GRState* state, Stmt* Loc,
|
||||||
{
|
{
|
||||||
|
|
||||||
Store store = state->getStore();
|
Store store = state->getStore();
|
||||||
VarBindingsTy B = GetVarBindings(store);
|
BindingsTy B = GetBindings(store);
|
||||||
typedef SVal::symbol_iterator symbol_iterator;
|
typedef SVal::symbol_iterator symbol_iterator;
|
||||||
|
|
||||||
// Iterate over the variable bindings.
|
// Iterate over the variable bindings.
|
||||||
for (VarBindingsTy::iterator I=B.begin(), E=B.end(); I!=E ; ++I) {
|
for (BindingsTy::iterator I=B.begin(), E=B.end(); I!=E ; ++I) {
|
||||||
const VarRegion *VR = cast<VarRegion>(I.getKey());
|
const VarRegion *VR = cast<VarRegion>(I.getKey());
|
||||||
if (SymReaper.isLive(Loc, VR->getDecl())) {
|
if (SymReaper.isLive(Loc, VR->getDecl())) {
|
||||||
RegionRoots.push_back(VR);
|
RegionRoots.push_back(VR);
|
||||||
|
@ -428,7 +428,7 @@ BasicStoreManager::RemoveDeadBindings(const GRState* state, Stmt* Loc,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove dead variable bindings.
|
// Remove dead variable bindings.
|
||||||
for (VarBindingsTy::iterator I=B.begin(), E=B.end(); I!=E ; ++I) {
|
for (BindingsTy::iterator I=B.begin(), E=B.end(); I!=E ; ++I) {
|
||||||
const VarRegion* R = cast<VarRegion>(I.getKey());
|
const VarRegion* R = cast<VarRegion>(I.getKey());
|
||||||
|
|
||||||
if (!Marked.count(R)) {
|
if (!Marked.count(R)) {
|
||||||
|
@ -554,12 +554,12 @@ void BasicStoreManager::print(Store store, std::ostream& O,
|
||||||
const char* nl, const char *sep) {
|
const char* nl, const char *sep) {
|
||||||
|
|
||||||
llvm::raw_os_ostream Out(O);
|
llvm::raw_os_ostream Out(O);
|
||||||
VarBindingsTy B = GetVarBindings(store);
|
BindingsTy B = GetBindings(store);
|
||||||
Out << "Variables:" << nl;
|
Out << "Variables:" << nl;
|
||||||
|
|
||||||
bool isFirst = true;
|
bool isFirst = true;
|
||||||
|
|
||||||
for (VarBindingsTy::iterator I=B.begin(), E=B.end(); I != E; ++I) {
|
for (BindingsTy::iterator I=B.begin(), E=B.end(); I != E; ++I) {
|
||||||
if (isFirst) isFirst = false;
|
if (isFirst) isFirst = false;
|
||||||
else Out << nl;
|
else Out << nl;
|
||||||
|
|
||||||
|
@ -570,9 +570,9 @@ void BasicStoreManager::print(Store store, std::ostream& O,
|
||||||
|
|
||||||
|
|
||||||
void BasicStoreManager::iterBindings(Store store, BindingsHandler& f) {
|
void BasicStoreManager::iterBindings(Store store, BindingsHandler& f) {
|
||||||
VarBindingsTy B = GetVarBindings(store);
|
BindingsTy B = GetBindings(store);
|
||||||
|
|
||||||
for (VarBindingsTy::iterator I=B.begin(), E=B.end(); I != E; ++I)
|
for (BindingsTy::iterator I=B.begin(), E=B.end(); I != E; ++I)
|
||||||
f.HandleBinding(*this, store, I.getKey(), I.getData());
|
f.HandleBinding(*this, store, I.getKey(), I.getData());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue