summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-06-23 18:05:21 +0000
committerTed Kremenek <kremenek@apple.com>2009-06-23 18:05:21 +0000
commit404b132dc0b62b1a5ba569268effe8bdf9016fff (patch)
tree4d01a8c50fb1ae541dac7633a72d3fa6d9aebc86 /clang/lib/Analysis
parent736ffeeab434c864a28278ec1a67df384165a1eb (diff)
downloadbcm5719-llvm-404b132dc0b62b1a5ba569268effe8bdf9016fff.tar.gz
bcm5719-llvm-404b132dc0b62b1a5ba569268effe8bdf9016fff.zip
Move 'hasStackStorage()' and 'hasHeapStorage()' from MemRegionManager to MemRegion.
llvm-svn: 73973
Diffstat (limited to 'clang/lib/Analysis')
-rw-r--r--clang/lib/Analysis/CFRefCount.cpp2
-rw-r--r--clang/lib/Analysis/GRExprEngine.cpp2
-rw-r--r--clang/lib/Analysis/MemRegion.cpp16
-rw-r--r--clang/lib/Analysis/RegionStore.cpp2
4 files changed, 11 insertions, 11 deletions
diff --git a/clang/lib/Analysis/CFRefCount.cpp b/clang/lib/Analysis/CFRefCount.cpp
index 1ccd0924f37..46333a74f27 100644
--- a/clang/lib/Analysis/CFRefCount.cpp
+++ b/clang/lib/Analysis/CFRefCount.cpp
@@ -3141,7 +3141,7 @@ void CFRefCount::EvalBind(GRStmtNodeBuilderRef& B, SVal location, SVal val) {
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/clang/lib/Analysis/GRExprEngine.cpp b/clang/lib/Analysis/GRExprEngine.cpp
index d5f0e406bb7..7d56d108deb 100644
--- a/clang/lib/Analysis/GRExprEngine.cpp
+++ b/clang/lib/Analysis/GRExprEngine.cpp
@@ -2764,7 +2764,7 @@ void GRExprEngine::VisitReturnStmt(ReturnStmt* S, NodeTy* Pred, NodeSet& Dst) {
// 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/clang/lib/Analysis/MemRegion.cpp b/clang/lib/Analysis/MemRegion.cpp
index 9bd93cd6eb9..f018c83b910 100644
--- a/clang/lib/Analysis/MemRegion.cpp
+++ b/clang/lib/Analysis/MemRegion.cpp
@@ -313,17 +313,17 @@ AllocaRegion* MemRegionManager::getAllocaRegion(const Expr* E, unsigned cnt) {
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 @@ bool MemRegionManager::hasStackStorage(const MemRegion* R) {
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/clang/lib/Analysis/RegionStore.cpp b/clang/lib/Analysis/RegionStore.cpp
index f76807beb29..17e332387f7 100644
--- a/clang/lib/Analysis/RegionStore.cpp
+++ b/clang/lib/Analysis/RegionStore.cpp
@@ -939,7 +939,7 @@ SVal RegionStoreManager::Retrieve(const GRState *state, Loc L, QualType T) {
}
}
- 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
OpenPOWER on IntegriCloud