[cfe-commits] r58272 - in /cfe/trunk: include/clang/Analysis/PathSensitive/MemRegion.h lib/Analysis/MemRegion.cpp

Ted Kremenek kremenek at apple.com
Mon Oct 27 14:01:26 PDT 2008


Author: kremenek
Date: Mon Oct 27 16:01:26 2008
New Revision: 58272

URL: http://llvm.org/viewvc/llvm-project?rev=58272&view=rev
Log:
Pull determination of the super region for a VarRegion into a single getVarRegion() method.  This provides a common clean API for clients.

Modified:
    cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h
    cfe/trunk/lib/Analysis/MemRegion.cpp

Modified: cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h?rev=58272&r1=58271&r2=58272&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/MemRegion.h Mon Oct 27 16:01:26 2008
@@ -430,14 +430,8 @@
   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);
 

Modified: cfe/trunk/lib/Analysis/MemRegion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/MemRegion.cpp?rev=58272&r1=58271&r2=58272&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/MemRegion.cpp (original)
+++ cfe/trunk/lib/Analysis/MemRegion.cpp Mon Oct 27 16:01:26 2008
@@ -189,8 +189,11 @@
   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);
   





More information about the cfe-commits mailing list