From 9a1f03afc569abbdcc182379c99d1fe1ece67c9d Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Mon, 27 Oct 2008 21:01:26 +0000 Subject: [PATCH] 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 --- include/clang/Analysis/PathSensitive/MemRegion.h | 10 ++-------- lib/Analysis/MemRegion.cpp | 7 +++++-- 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); -- 2.50.1