]> granicus.if.org Git - clang/commitdiff
Move common methods to the base StoreManager class.
authorZhongxing Xu <xuzhongxing@gmail.com>
Mon, 8 Feb 2010 07:10:35 +0000 (07:10 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Mon, 8 Feb 2010 07:10:35 +0000 (07:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95534 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Checker/PathSensitive/Store.h
lib/Checker/BasicStore.cpp
lib/Checker/RegionStore.cpp
lib/Checker/Store.cpp

index 7d93688344f525e6e900ac95de9bc9fa0ebdef6d..9a5ebf36d6a7f4be619969efa435369cf889293c 100644 (file)
@@ -89,12 +89,18 @@ public:
   //   caller's responsibility to 'delete' the returned map.
   virtual SubRegionMap *getSubRegionMap(Store store) = 0;
 
-  virtual SVal getLValueVar(const VarDecl *VD, const LocationContext *LC) = 0;
+  virtual SVal getLValueVar(const VarDecl *VD, const LocationContext *LC) {
+    return ValMgr.makeLoc(MRMgr.getVarRegion(VD, LC));
+  }
 
-  virtual SVal getLValueString(const StringLiteral* sl) = 0;
+  virtual SVal getLValueString(const StringLiteral* S) {
+    return ValMgr.makeLoc(MRMgr.getStringRegion(S));
+  }
 
-  SVal getLValueCompoundLiteral(const CompoundLiteralExpr* cl,
-                                const LocationContext *LC);
+  SVal getLValueCompoundLiteral(const CompoundLiteralExpr* CL,
+                                const LocationContext *LC) {
+    return loc::MemRegionVal(MRMgr.getCompoundLiteralRegion(CL, LC));
+  }
 
   virtual SVal getLValueIvar(const ObjCIvarDecl* decl, SVal base) = 0;
 
index e2c96759a4eeb4c350279c4eff85b09bcbb2dfef..8d52bf53beaef55b5f502a0901feb515675558b0 100644 (file)
@@ -70,8 +70,6 @@ public:
     return store;
   }
 
-  SVal getLValueVar(const VarDecl *VD, const LocationContext *LC);
-  SVal getLValueString(const StringLiteral *S);
   SVal getLValueIvar(const ObjCIvarDecl* D, SVal Base);
   SVal getLValueField(const FieldDecl *D, SVal Base);
   SVal getLValueElement(QualType elementType, SVal Offset, SVal Base);
@@ -115,15 +113,6 @@ StoreManager* clang::CreateBasicStoreManager(GRStateManager& StMgr) {
   return new BasicStoreManager(StMgr);
 }
 
-SVal BasicStoreManager::getLValueVar(const VarDecl* VD, 
-                                     const LocationContext *LC) {
-  return ValMgr.makeLoc(MRMgr.getVarRegion(VD, LC));
-}
-
-SVal BasicStoreManager::getLValueString(const StringLiteral* S) {
-  return ValMgr.makeLoc(MRMgr.getStringRegion(S));
-}
-
 SVal BasicStoreManager::getLValueIvar(const ObjCIvarDecl* D, SVal Base) {
 
   if (Base.isUnknownOrUndef())
index 36022d57376dbb0f79217185a626f2a2a09d5ea4..139ef6a7e21fabaa0727f8031e38bccea3968dd8 100644 (file)
@@ -232,23 +232,6 @@ public:
   ///  the value is not specified.  
   Store setImplicitDefaultValue(Store store, const MemRegion *R, QualType T);
 
-  /// getLValueString - Returns an SVal representing the lvalue of a
-  ///  StringLiteral.  Within RegionStore a StringLiteral has an
-  ///  associated StringRegion, and the lvalue of a StringLiteral is
-  ///  the lvalue of that region.
-  SVal getLValueString(const StringLiteral* S);
-
-  /// getLValueCompoundLiteral - Returns an SVal representing the
-  ///   lvalue of a compound literal.  Within RegionStore a compound
-  ///   literal has an associated region, and the lvalue of the
-  ///   compound literal is the lvalue of that region.
-  SVal getLValueCompoundLiteral(const CompoundLiteralExpr*);
-
-  /// getLValueVar - Returns an SVal that represents the lvalue of a
-  ///  variable.  Within RegionStore a variable has an associated
-  ///  VarRegion, and the lvalue of the variable is the lvalue of that region.
-  SVal getLValueVar(const VarDecl *VD, const LocationContext *LC);
-
   SVal getLValueIvar(const ObjCIvarDecl* D, SVal Base);
 
   SVal getLValueField(const FieldDecl* D, SVal Base);
@@ -680,22 +663,6 @@ Store RegionStoreManager::InvalidateRegions(Store store,
 // getLValueXXX methods.
 //===----------------------------------------------------------------------===//
 
-/// getLValueString - Returns an SVal representing the lvalue of a
-///  StringLiteral.  Within RegionStore a StringLiteral has an
-///  associated StringRegion, and the lvalue of a StringLiteral is the
-///  lvalue of that region.
-SVal RegionStoreManager::getLValueString(const StringLiteral* S) {
-  return loc::MemRegionVal(MRMgr.getStringRegion(S));
-}
-
-/// getLValueVar - Returns an SVal that represents the lvalue of a
-///  variable.  Within RegionStore a variable has an associated
-///  VarRegion, and the lvalue of the variable is the lvalue of that region.
-SVal RegionStoreManager::getLValueVar(const VarDecl *VD, 
-                                      const LocationContext *LC) {
-  return loc::MemRegionVal(MRMgr.getVarRegion(VD, LC));
-}
-
 SVal RegionStoreManager::getLValueIvar(const ObjCIvarDecl* D, SVal Base) {
   return getLValueFieldOrIvar(D, Base);
 }
index 5893733c54dace17dec61ac9bdd68c0127a7422b..5a8f88533245fb8c1ba1947dca8d49ff4c68b519 100644 (file)
@@ -234,16 +234,3 @@ Store StoreManager::InvalidateRegions(Store store,
   
   return store;
 }
-
-//===----------------------------------------------------------------------===//
-// Common getLValueXXX methods.
-//===----------------------------------------------------------------------===//
-
-/// getLValueCompoundLiteral - Returns an SVal representing the lvalue
-///   of a compound literal.  Within RegionStore a compound literal
-///   has an associated region, and the lvalue of the compound literal
-///   is the lvalue of that region.
-SVal StoreManager::getLValueCompoundLiteral(const CompoundLiteralExpr* CL,
-                                            const LocationContext *LC) {
-  return loc::MemRegionVal(MRMgr.getCompoundLiteralRegion(CL, LC));
-}