diff --git a/clang/include/clang/Analysis/PathSensitive/MemRegion.h b/clang/include/clang/Analysis/PathSensitive/MemRegion.h index ffbef1b122d2..82f0e9189602 100644 --- a/clang/include/clang/Analysis/PathSensitive/MemRegion.h +++ b/clang/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/clang/lib/Analysis/MemRegion.cpp b/clang/lib/Analysis/MemRegion.cpp index 8a7be0d56481..27ecffdc06ea 100644 --- a/clang/lib/Analysis/MemRegion.cpp +++ b/clang/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);