[cfe-commits] r61888 - in /cfe/trunk: include/clang/Analysis/PathSensitive/Store.h lib/Analysis/BasicStore.cpp lib/Analysis/RegionStore.cpp

Ted Kremenek kremenek at apple.com
Wed Jan 7 14:18:50 PST 2009


Author: kremenek
Date: Wed Jan  7 16:18:50 2009
New Revision: 61888

URL: http://llvm.org/viewvc/llvm-project?rev=61888&view=rev
Log:
Refactor MemRegionManager instance variable into parent class.  No functionality change.

Modified:
    cfe/trunk/include/clang/Analysis/PathSensitive/Store.h
    cfe/trunk/lib/Analysis/BasicStore.cpp
    cfe/trunk/lib/Analysis/RegionStore.cpp

Modified: cfe/trunk/include/clang/Analysis/PathSensitive/Store.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/Store.h?rev=61888&r1=61887&r2=61888&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/Store.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/Store.h Wed Jan  7 16:18:50 2009
@@ -37,7 +37,14 @@
 public:
   typedef llvm::SmallSet<SymbolRef, 20>      LiveSymbolsTy;
   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() {}
   
   /// Retrieve - Retrieves the value bound to specified location.  The optional
@@ -64,7 +71,7 @@
                                              SVal V) = 0;
   
   virtual Store getInitialStore() = 0;
-  virtual MemRegionManager& getRegionManager() = 0;
+  MemRegionManager& getRegionManager() { return MRMgr; }
 
   virtual SVal getLValueVar(const GRState* St, const VarDecl* VD) = 0;
 

Modified: cfe/trunk/lib/Analysis/BasicStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/BasicStore.cpp?rev=61888&r1=61887&r2=61888&view=diff

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

Modified: cfe/trunk/lib/Analysis/RegionStore.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/RegionStore.cpp?rev=61888&r1=61887&r2=61888&view=diff

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





More information about the cfe-commits mailing list