Move 'hasStackStorage()' and 'hasHeapStorage()' from MemRegionManager to MemRegion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73973 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index 1ccd092..46333a7 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -3141,7 +3141,7 @@
     escapes = true;
   else {
     const MemRegion* R = cast<loc::MemRegionVal>(location).getRegion();
-    escapes = !B.getStateManager().hasStackStorage(R);
+    escapes = !R->hasStackStorage();
     
     if (!escapes) {
       // To test (3), generate a new state with the binding removed.  If it is
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp
index d5f0e40..7d56d10 100644
--- a/lib/Analysis/GRExprEngine.cpp
+++ b/lib/Analysis/GRExprEngine.cpp
@@ -2764,7 +2764,7 @@
       // Determine if the value is on the stack.
       const MemRegion* R = cast<loc::MemRegionVal>(&X)->getRegion();
       
-      if (R && getStateManager().hasStackStorage(R)) {
+      if (R && R->hasStackStorage()) {
         // Create a special node representing the error.
         if (NodeTy* N = Builder->generateNode(S, GetState(*I), *I)) {
           N->markAsSink();
diff --git a/lib/Analysis/MemRegion.cpp b/lib/Analysis/MemRegion.cpp
index 9bd93cd..f018c83 100644
--- a/lib/Analysis/MemRegion.cpp
+++ b/lib/Analysis/MemRegion.cpp
@@ -313,17 +313,17 @@
   return getRegion<AllocaRegion>(E, cnt);
 }
 
-bool MemRegionManager::hasStackStorage(const MemRegion* R) {
+bool MemRegion::hasStackStorage() const {
   // Only subregions can have stack storage.
-  const SubRegion* SR = dyn_cast<SubRegion>(R);
+  const SubRegion* SR = dyn_cast<SubRegion>(this);
 
   if (!SR)
     return false;
 
-  MemSpaceRegion* S = getStackRegion();
+  MemSpaceRegion* S = getMemRegionManager()->getStackRegion();
   
   while (SR) {
-    R = SR->getSuperRegion();
+    const MemRegion *R = SR->getSuperRegion();
     if (R == S)
       return true;
     
@@ -333,17 +333,17 @@
   return false;
 }
 
-bool MemRegionManager::hasHeapStorage(const MemRegion* R) {
+bool MemRegion::hasHeapStorage() const {
   // Only subregions can have stack storage.
-  const SubRegion* SR = dyn_cast<SubRegion>(R);
+  const SubRegion* SR = dyn_cast<SubRegion>(this);
 
   if (!SR)
     return false;
 
-  MemSpaceRegion* H = getHeapRegion();
+  MemSpaceRegion* H = getMemRegionManager()->getHeapRegion();
 
   while (SR) {
-    R = SR->getSuperRegion();
+    const MemRegion *R = SR->getSuperRegion();
     if (R == H)
       return true;
 
diff --git a/lib/Analysis/RegionStore.cpp b/lib/Analysis/RegionStore.cpp
index f76807b..17e3323 100644
--- a/lib/Analysis/RegionStore.cpp
+++ b/lib/Analysis/RegionStore.cpp
@@ -939,7 +939,7 @@
     }
   }  
 
-  if (MRMgr.hasStackStorage(R) || MRMgr.hasHeapStorage(R)) {
+  if (R->hasStackStorage() || R->hasHeapStorage()) {
     // All stack variables are considered to have undefined values
     // upon creation.  All heap allocated blocks are considered to
     // have undefined values as well unless they are explicitly bound