forked from OSchip/llvm-project
[analyzer] Add StoreManager::includedInBindings() to to query whether a region is used in any bindings.
llvm-svn: 136416
This commit is contained in:
parent
6b1a761f3e
commit
ae16d1cc67
|
|
@ -153,6 +153,9 @@ public:
|
|||
|
||||
virtual StoreRef BindDeclWithNoInit(Store store, const VarRegion *VR) = 0;
|
||||
|
||||
virtual bool includedInBindings(Store store,
|
||||
const MemRegion *region) const = 0;
|
||||
|
||||
/// If the StoreManager supports it, increment the reference count of
|
||||
/// the specified Store object.
|
||||
virtual void incrementReferenceCount(Store store) {}
|
||||
|
|
@ -270,10 +273,8 @@ public:
|
|||
};
|
||||
|
||||
// FIXME: Do we need to pass GRStateManager anymore?
|
||||
StoreManager *CreateBasicStoreManager(GRStateManager& StMgr);
|
||||
StoreManager *CreateRegionStoreManager(GRStateManager& StMgr);
|
||||
StoreManager *CreateFieldsOnlyRegionStoreManager(GRStateManager& StMgr);
|
||||
StoreManager *CreateFlatStoreManager(GRStateManager &StMgr);
|
||||
|
||||
} // end GR namespace
|
||||
|
||||
|
|
|
|||
|
|
@ -308,6 +308,8 @@ public: // Part of public interface to class.
|
|||
GetRegionBindings(store).manualRelease();
|
||||
}
|
||||
|
||||
bool includedInBindings(Store store, const MemRegion *region) const;
|
||||
|
||||
//===------------------------------------------------------------------===//
|
||||
// Loading values from regions.
|
||||
//===------------------------------------------------------------------===//
|
||||
|
|
@ -1284,6 +1286,23 @@ SVal RegionStoreManager::RetrieveArray(Store store, const TypedRegion * R) {
|
|||
return svalBuilder.makeLazyCompoundVal(StoreRef(store, *this), R);
|
||||
}
|
||||
|
||||
bool RegionStoreManager::includedInBindings(Store store,
|
||||
const MemRegion *region) const {
|
||||
RegionBindings B = GetRegionBindings(store);
|
||||
region = region->getBaseRegion();
|
||||
|
||||
for (RegionBindings::iterator it = B.begin(), ei = B.end(); it != ei; ++it) {
|
||||
const BindingKey &K = it.getKey();
|
||||
if (region == K.getRegion())
|
||||
return true;
|
||||
const SVal &D = it.getData();
|
||||
if (const MemRegion *r = D.getAsRegion())
|
||||
if (r == region)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Binding values to regions.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
|||
Loading…
Reference in New Issue