Refactor MemRegionManager instance variable into parent class. No functionality change.

llvm-svn: 61888
This commit is contained in:
Ted Kremenek 2009-01-07 22:18:50 +00:00
parent f325278799
commit 682c3a6dd6
3 changed files with 15 additions and 10 deletions

View File

@ -37,7 +37,14 @@ class StoreManager {
public: public:
typedef llvm::SmallSet<SymbolRef, 20> LiveSymbolsTy; typedef llvm::SmallSet<SymbolRef, 20> LiveSymbolsTy;
typedef llvm::DenseSet<SymbolRef> DeadSymbolsTy; typedef llvm::DenseSet<SymbolRef> DeadSymbolsTy;
protected:
/// MRMgr - Manages region objects associated with this StoreManager.
MemRegionManager MRMgr;
StoreManager(llvm::BumpPtrAllocator& Alloc) : MRMgr(Alloc) {}
public:
virtual ~StoreManager() {} virtual ~StoreManager() {}
/// Retrieve - Retrieves the value bound to specified location. The optional /// Retrieve - Retrieves the value bound to specified location. The optional
@ -64,7 +71,7 @@ public:
SVal V) = 0; SVal V) = 0;
virtual Store getInitialStore() = 0; virtual Store getInitialStore() = 0;
virtual MemRegionManager& getRegionManager() = 0; MemRegionManager& getRegionManager() { return MRMgr; }
virtual SVal getLValueVar(const GRState* St, const VarDecl* VD) = 0; virtual SVal getLValueVar(const GRState* St, const VarDecl* VD) = 0;

View File

@ -26,14 +26,13 @@ namespace {
class VISIBILITY_HIDDEN BasicStoreManager : public StoreManager { class VISIBILITY_HIDDEN BasicStoreManager : public StoreManager {
VarBindingsTy::Factory VBFactory; VarBindingsTy::Factory VBFactory;
GRStateManager& StateMgr; GRStateManager& StateMgr;
MemRegionManager MRMgr;
const MemRegion* SelfRegion; const MemRegion* SelfRegion;
public: public:
BasicStoreManager(GRStateManager& mgr) BasicStoreManager(GRStateManager& mgr)
: VBFactory(mgr.getAllocator()), : StoreManager(mgr.getAllocator()),
VBFactory(mgr.getAllocator()),
StateMgr(mgr), StateMgr(mgr),
MRMgr(StateMgr.getAllocator()),
SelfRegion(0) {} SelfRegion(0) {}
~BasicStoreManager() {} ~BasicStoreManager() {}
@ -49,7 +48,6 @@ public:
Store BindInternal(Store St, Loc LV, SVal V); Store BindInternal(Store St, Loc LV, SVal V);
Store Remove(Store St, Loc LV); Store Remove(Store St, Loc LV);
Store getInitialStore(); Store getInitialStore();
MemRegionManager& getRegionManager() { return MRMgr; }
// FIXME: Investigate what is using this. This method should be removed. // FIXME: Investigate what is using this. This method should be removed.
virtual Loc getLoc(const VarDecl* VD) { virtual Loc getLoc(const VarDecl* VD) {

View File

@ -54,6 +54,7 @@ namespace clang {
// //
// MemRegions represent chunks of memory with a size (their "extent"). This // MemRegions represent chunks of memory with a size (their "extent"). This
// GDM entry tracks the extents for regions. Extents are in bytes. // GDM entry tracks the extents for regions. Extents are in bytes.
//
namespace { class VISIBILITY_HIDDEN RegionExtents {}; } namespace { class VISIBILITY_HIDDEN RegionExtents {}; }
static int RegionExtentsIndex = 0; static int RegionExtentsIndex = 0;
namespace clang { namespace clang {
@ -108,14 +109,13 @@ class VISIBILITY_HIDDEN RegionStoreManager : public StoreManager {
RegionViews::Factory RVFactory; RegionViews::Factory RVFactory;
GRStateManager& StateMgr; GRStateManager& StateMgr;
MemRegionManager MRMgr;
public: public:
RegionStoreManager(GRStateManager& mgr) RegionStoreManager(GRStateManager& mgr)
: RBFactory(mgr.getAllocator()), : StoreManager(mgr.getAllocator()),
RBFactory(mgr.getAllocator()),
RVFactory(mgr.getAllocator()), RVFactory(mgr.getAllocator()),
StateMgr(mgr), StateMgr(mgr) {}
MRMgr(StateMgr.getAllocator()) {}
virtual ~RegionStoreManager() {} virtual ~RegionStoreManager() {}