aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/MemRegion.cpp
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2009-06-23 02:51:21 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2009-06-23 02:51:21 +0000
commitdd198f04897df87c52fef66398035cbf67fdc33d (patch)
tree708bbe74a31c3e9e7a1fc700a15fbdc943f40a3c /lib/Analysis/MemRegion.cpp
parent83298da65412ac607efe22664fdb51e05e3ae960 (diff)
Remove duplicated methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73940 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/MemRegion.cpp')
-rw-r--r--lib/Analysis/MemRegion.cpp36
1 files changed, 20 insertions, 16 deletions
diff --git a/lib/Analysis/MemRegion.cpp b/lib/Analysis/MemRegion.cpp
index a923ac29eb..619d1617d0 100644
--- a/lib/Analysis/MemRegion.cpp
+++ b/lib/Analysis/MemRegion.cpp
@@ -234,20 +234,6 @@ MemSpaceRegion* MemRegionManager::getCodeRegion() {
return LazyAllocate(code);
}
-bool MemRegionManager::onStack(const MemRegion* R) {
- while (const SubRegion* SR = dyn_cast<SubRegion>(R))
- R = SR->getSuperRegion();
-
- return (R != 0) && (R == stack);
-}
-
-bool MemRegionManager::onHeap(const MemRegion* R) {
- while (const SubRegion* SR = dyn_cast<SubRegion>(R))
- R = SR->getSuperRegion();
-
- return (R != 0) && (R == heap);
-}
-
//===----------------------------------------------------------------------===//
// Constructing regions.
//===----------------------------------------------------------------------===//
@@ -352,7 +338,6 @@ AllocaRegion* MemRegionManager::getAllocaRegion(const Expr* E, unsigned cnt) {
}
bool MemRegionManager::hasStackStorage(const MemRegion* R) {
-
// Only subregions can have stack storage.
const SubRegion* SR = dyn_cast<SubRegion>(R);
@@ -368,10 +353,29 @@ bool MemRegionManager::hasStackStorage(const MemRegion* R) {
SR = dyn_cast<SubRegion>(R);
}
-
+
return false;
}
+bool MemRegionManager::hasHeapStorage(const MemRegion* R) {
+ // Only subregions can have stack storage.
+ const SubRegion* SR = dyn_cast<SubRegion>(R);
+
+ if (!SR)
+ return false;
+
+ MemSpaceRegion* H = getHeapRegion();
+
+ while (SR) {
+ R = SR->getSuperRegion();
+ if (R == H)
+ return true;
+
+ SR = dyn_cast<SubRegion>(R);
+ }
+
+ return false;
+}
//===----------------------------------------------------------------------===//
// View handling.