aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-10-27 21:01:26 +0000
committerTed Kremenek <kremenek@apple.com>2008-10-27 21:01:26 +0000
commit9a1f03afc569abbdcc182379c99d1fe1ece67c9d (patch)
tree088678ea6f5e5e43e871bb28da3dfb81d6a80de2
parent329d6fde79254503b14724e1231a9d70fa6b387f (diff)
Pull determination of the super region for a VarRegion into a single getVarRegion() method. This provides a common clean API for clients.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58272 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Analysis/PathSensitive/MemRegion.h10
-rw-r--r--lib/Analysis/MemRegion.cpp7
2 files changed, 7 insertions, 10 deletions
diff --git a/include/clang/Analysis/PathSensitive/MemRegion.h b/include/clang/Analysis/PathSensitive/MemRegion.h
index ffbef1b122..82f0e91896 100644
--- a/include/clang/Analysis/PathSensitive/MemRegion.h
+++ b/include/clang/Analysis/PathSensitive/MemRegion.h
@@ -430,14 +430,8 @@ public:
StringRegion* getStringRegion(const StringLiteral* Str);
/// getVarRegion - Retrieve or create the memory region associated with
- /// a specified VarDecl. 'superRegion' corresponds to the containing
- /// memory region, and 'off' is the offset within the containing region.
- VarRegion* getVarRegion(const VarDecl* vd, const MemRegion* superRegion);
-
- VarRegion* getVarRegion(const VarDecl* vd) {
- return getVarRegion(vd, vd->hasLocalStorage() ? getStackRegion()
- : getGlobalsRegion());
- }
+ /// a specified VarDecl.
+ VarRegion* getVarRegion(const VarDecl* vd);
ElementRegion* getElementRegion(SVal Idx, const MemRegion* superRegion);
diff --git a/lib/Analysis/MemRegion.cpp b/lib/Analysis/MemRegion.cpp
index 8a7be0d564..27ecffdc06 100644
--- a/lib/Analysis/MemRegion.cpp
+++ b/lib/Analysis/MemRegion.cpp
@@ -189,8 +189,11 @@ StringRegion* MemRegionManager::getStringRegion(const StringLiteral* Str) {
return R;
}
-VarRegion* MemRegionManager::getVarRegion(const VarDecl* d,
- const MemRegion* superRegion) {
+VarRegion* MemRegionManager::getVarRegion(const VarDecl* d) {
+
+ const MemRegion* superRegion = d->hasLocalStorage() ? getStackRegion()
+ : getGlobalsRegion();
+
llvm::FoldingSetNodeID ID;
DeclRegion::ProfileRegion(ID, d, superRegion, MemRegion::VarRegionKind);