[cfe-commits] r61894 - in /cfe/trunk: include/clang/Analysis/PathSensitive/GRState.h include/clang/Analysis/PathSensitive/Store.h lib/Analysis/BasicStore.cpp

Ted Kremenek kremenek at apple.com
Wed Jan 7 14:56:17 PST 2009


Author: kremenek
Date: Wed Jan  7 16:56:17 2009
New Revision: 61894

URL: http://llvm.org/viewvc/llvm-project?rev=61894&view=rev
Log:
Update some doxygen comments to be more rich.  Remove StoreManager::GetRegionSVal.

Modified:
    cfe/trunk/include/clang/Analysis/PathSensitive/GRState.h
    cfe/trunk/include/clang/Analysis/PathSensitive/Store.h
    cfe/trunk/lib/Analysis/BasicStore.cpp

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

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/GRState.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/GRState.h Wed Jan  7 16:56:17 2009
@@ -474,7 +474,7 @@
   }
   
   SVal GetSVal(const GRState* state, const MemRegion* R) {
-    return StoreMgr->GetRegionSVal(state, R);
+    return StoreMgr->Retrieve(state, loc::MemRegionVal(R));
   }  
   
   const GRState* BindLoc(const GRState* St, Loc LV, SVal V) {

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

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/Store.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/Store.h Wed Jan  7 16:56:17 2009
@@ -47,18 +47,29 @@
 public:  
   virtual ~StoreManager() {}
   
-  /// Retrieve - Retrieves the value bound to specified location.  The optional
-  ///  QualType information provides a hint to the store indicating the expected
-  ///  type of the returned value.
-  virtual SVal Retrieve(const GRState* state, Loc LV, QualType T=QualType()) =0;  
-
-  /// GetRegionSVal - Retrieves  the value bound to the specified region.
-  SVal GetRegionSVal(const GRState* state, const MemRegion* R) {
-    return Retrieve(state, loc::MemRegionVal(R));
-  }
-
-  /// Bind value V to location L.
-  virtual const GRState* Bind(const GRState* St, Loc L, SVal V) = 0;
+  /// Return the value bound to specified location in a given state.
+  /// \param[in] state The analysis state.
+  /// \param[in] loc The symbolic memory location.
+  /// \param[in] T An optional type that provides a hint indicating the 
+  ///   expected type of the returned value.  This is used if the value is
+  ///   lazily computed.
+  /// \return The value bound to the location \c loc.
+  virtual SVal Retrieve(const GRState* state, Loc loc,
+                        QualType T = QualType()) = 0;  
+
+//  /// Retrieves the value bound to the specified region.
+//  SVal GetRegionSVal(const GRState* state, const MemRegion* R) {
+//    return Retrieve(state, loc::MemRegionVal(R));
+//  }
+
+  /// Return a state with the specified value bound to the given location.
+  /// \param[in] state The analysis state.
+  /// \param[in] loc The symbolic memory location.
+  /// \param[in] val The value to bind to location \c loc.
+  /// \return A pointer to a GRState object that contains the same bindings as 
+  ///   \c state with the addition of having the value specified by \c val bound
+  ///   to the location given for \c loc.
+  virtual const GRState* Bind(const GRState* state, Loc loc, SVal val) = 0;
 
   virtual Store Remove(Store St, Loc L) = 0;
   

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

==============================================================================
--- cfe/trunk/lib/Analysis/BasicStore.cpp (original)
+++ cfe/trunk/lib/Analysis/BasicStore.cpp Wed Jan  7 16:56:17 2009
@@ -37,7 +37,7 @@
   
   ~BasicStoreManager() {}
 
-  SVal Retrieve(const GRState *state, Loc LV, QualType T);  
+  SVal Retrieve(const GRState *state, Loc loc, QualType T = QualType());  
 
   const GRState* Bind(const GRState* St, Loc L, SVal V) {
     Store store = St->getStore();
@@ -45,8 +45,8 @@
     return StateMgr.MakeStateWithStore(St, store);
   }
 
-  Store BindInternal(Store St, Loc LV, SVal V);  
-  Store Remove(Store St, Loc LV);
+  Store BindInternal(Store St, Loc loc, SVal V);  
+  Store Remove(Store St, Loc loc);
   Store getInitialStore();
 
   // FIXME: Investigate what is using this. This method should be removed.
@@ -263,18 +263,18 @@
     return UnknownVal();
 }
 
-SVal BasicStoreManager::Retrieve(const GRState* state, Loc LV, QualType T) {
+SVal BasicStoreManager::Retrieve(const GRState* state, Loc loc, QualType T) {
   
-  if (isa<UnknownVal>(LV))
+  if (isa<UnknownVal>(loc))
     return UnknownVal();
   
-  assert (!isa<UndefinedVal>(LV));
+  assert (!isa<UndefinedVal>(loc));
   
-  switch (LV.getSubKind()) {
+  switch (loc.getSubKind()) {
 
     case loc::MemRegionKind: {
       const VarRegion* R =
-        dyn_cast<VarRegion>(cast<loc::MemRegionVal>(LV).getRegion());
+        dyn_cast<VarRegion>(cast<loc::MemRegionVal>(loc).getRegion());
       
       if (!R)
         return UnknownVal();
@@ -294,7 +294,7 @@
       // invalidate their bindings).  Just return Undefined.
       return UndefinedVal();            
     case loc::FuncValKind:
-      return LV;
+      return loc;
       
     default:
       assert (false && "Invalid Loc.");
@@ -304,11 +304,11 @@
   return UnknownVal();
 }
   
-Store BasicStoreManager::BindInternal(Store store, Loc LV, SVal V) {    
-  switch (LV.getSubKind()) {      
+Store BasicStoreManager::BindInternal(Store store, Loc loc, SVal V) {    
+  switch (loc.getSubKind()) {      
     case loc::MemRegionKind: {
       const VarRegion* R =
-        dyn_cast<VarRegion>(cast<loc::MemRegionVal>(LV).getRegion());
+        dyn_cast<VarRegion>(cast<loc::MemRegionVal>(loc).getRegion());
       
       if (!R)
         return store;
@@ -324,11 +324,11 @@
   }
 }
 
-Store BasicStoreManager::Remove(Store store, Loc LV) {
-  switch (LV.getSubKind()) {
+Store BasicStoreManager::Remove(Store store, Loc loc) {
+  switch (loc.getSubKind()) {
     case loc::MemRegionKind: {
       const VarRegion* R =
-        dyn_cast<VarRegion>(cast<loc::MemRegionVal>(LV).getRegion());
+        dyn_cast<VarRegion>(cast<loc::MemRegionVal>(loc).getRegion());
       
       if (!R)
         return store;
@@ -379,7 +379,7 @@
           break;
         
         Marked.insert(R);
-        SVal X = GetRegionSVal(state, R);      
+        SVal X = Retrieve(state, loc::MemRegionVal(R));
     
         // FIXME: We need to handle symbols nested in region definitions.
         for (symbol_iterator SI=X.symbol_begin(), SE=X.symbol_end(); SI!=SE; ++SI)





More information about the cfe-commits mailing list