diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-06-23 02:51:21 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-06-23 02:51:21 +0000 |
commit | 1a195b264f3a8f3cd776a9184f90b7ef2025a182 (patch) | |
tree | e2f25290144ff0bf0de5962e69f5eb3f62eb30e6 /clang/lib/Analysis/MemRegion.cpp | |
parent | 74fa0bc3deba85515ba650ee075310507c380b19 (diff) | |
download | bcm5719-llvm-1a195b264f3a8f3cd776a9184f90b7ef2025a182.tar.gz bcm5719-llvm-1a195b264f3a8f3cd776a9184f90b7ef2025a182.zip |
Remove duplicated methods.
llvm-svn: 73940
Diffstat (limited to 'clang/lib/Analysis/MemRegion.cpp')
-rw-r--r-- | clang/lib/Analysis/MemRegion.cpp | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/clang/lib/Analysis/MemRegion.cpp b/clang/lib/Analysis/MemRegion.cpp index a923ac29eb3..619d1617d00 100644 --- a/clang/lib/Analysis/MemRegion.cpp +++ b/clang/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. |