Pull determination of the super region for a VarRegion into a single getVarRegion() method. This provides a common clean API for clients.

llvm-svn: 58272
This commit is contained in:
Ted Kremenek 2008-10-27 21:01:26 +00:00
parent bc48caf383
commit eaf5e24cbb
2 changed files with 7 additions and 10 deletions

View File

@ -430,14 +430,8 @@ public:
StringRegion* getStringRegion(const StringLiteral* Str); StringRegion* getStringRegion(const StringLiteral* Str);
/// getVarRegion - Retrieve or create the memory region associated with /// getVarRegion - Retrieve or create the memory region associated with
/// a specified VarDecl. 'superRegion' corresponds to the containing /// a specified VarDecl.
/// memory region, and 'off' is the offset within the containing region. VarRegion* getVarRegion(const VarDecl* vd);
VarRegion* getVarRegion(const VarDecl* vd, const MemRegion* superRegion);
VarRegion* getVarRegion(const VarDecl* vd) {
return getVarRegion(vd, vd->hasLocalStorage() ? getStackRegion()
: getGlobalsRegion());
}
ElementRegion* getElementRegion(SVal Idx, const MemRegion* superRegion); ElementRegion* getElementRegion(SVal Idx, const MemRegion* superRegion);

View File

@ -189,8 +189,11 @@ StringRegion* MemRegionManager::getStringRegion(const StringLiteral* Str) {
return R; return R;
} }
VarRegion* MemRegionManager::getVarRegion(const VarDecl* d, VarRegion* MemRegionManager::getVarRegion(const VarDecl* d) {
const MemRegion* superRegion) {
const MemRegion* superRegion = d->hasLocalStorage() ? getStackRegion()
: getGlobalsRegion();
llvm::FoldingSetNodeID ID; llvm::FoldingSetNodeID ID;
DeclRegion::ProfileRegion(ID, d, superRegion, MemRegion::VarRegionKind); DeclRegion::ProfileRegion(ID, d, superRegion, MemRegion::VarRegionKind);