]> granicus.if.org Git - clang/commitdiff
Remove loc::FuncVal.
authorZhongxing Xu <xuzhongxing@gmail.com>
Mon, 20 Apr 2009 06:35:22 +0000 (06:35 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Mon, 20 Apr 2009 06:35:22 +0000 (06:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69577 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/PathSensitive/SVals.h
lib/Analysis/BasicStore.cpp
lib/Analysis/GRSimpleVals.cpp
lib/Analysis/RegionStore.cpp
lib/Analysis/SVals.cpp
lib/Analysis/SimpleConstraintManager.cpp

index d16b3390ebeec47386a667dfa1632b1f488aebc1..70c0d09a0347a2d0bf1a358c2f544803e2fa0624 100644 (file)
@@ -362,7 +362,7 @@ public:
 
 namespace loc {
   
-enum Kind { GotoLabelKind, MemRegionKind, FuncValKind, ConcreteIntKind };
+enum Kind { GotoLabelKind, MemRegionKind, ConcreteIntKind };
 
 class GotoLabel : public Loc {
 public:
@@ -415,33 +415,6 @@ public:
   }    
 };
 
-class FuncVal : public Loc {
-public:
-  FuncVal(const FunctionDecl* fd) : Loc(FuncValKind, fd) {}
-  
-  FunctionDecl* getDecl() const {
-    return static_cast<FunctionDecl*>(Data);
-  }
-  
-  inline bool operator==(const FuncVal& R) const {
-    return getDecl() == R.getDecl();
-  }
-  
-  inline bool operator!=(const FuncVal& R) const {
-    return getDecl() != R.getDecl();
-  }
-  
-  // Implement isa<T> support.
-  static inline bool classof(const SVal* V) {
-    return V->getBaseKind() == LocKind &&
-           V->getSubKind() == FuncValKind;
-  }
-  
-  static inline bool classof(const Loc* V) {
-    return V->getSubKind() == FuncValKind;
-  }
-};
-
 class ConcreteInt : public Loc {
 public:
   ConcreteInt(const llvm::APSInt& V) : Loc(ConcreteIntKind, &V) {}
index 9047d9d8a950976d17f1e6064352efda800d079e..cf8d3176c45b59593865f5e77b57b8ab9c8fe99a 100644 (file)
@@ -200,8 +200,6 @@ SVal BasicStoreManager::getLValueField(const GRState* St, SVal Base,
   
   switch(BaseL.getSubKind()) {
     case loc::GotoLabelKind:
-    case loc::FuncValKind:
-      // Technically we can get here if people do funny things with casts.
       return UndefinedVal();
 
     case loc::MemRegionKind:
@@ -234,7 +232,6 @@ SVal BasicStoreManager::getLValueElement(const GRState* St, SVal Base,
   
   switch(BaseL.getSubKind()) {
     case loc::GotoLabelKind:
-    case loc::FuncValKind:
       // Technically we can get here if people do funny things with casts.
       return UndefinedVal();
       
@@ -338,8 +335,6 @@ SVal BasicStoreManager::Retrieve(const GRState* state, Loc loc, QualType T) {
       // they are doing a quick scan through their Locs (potentially to
       // invalidate their bindings).  Just return Undefined.
       return UndefinedVal();            
-    case loc::FuncValKind:
-      return loc;
       
     default:
       assert (false && "Invalid Loc.");
index 107bea705c38bd03a42813fe8a17892ffaebfd8b..413ef7b5ba702aebb1e79e9f9301bace07894790 100644 (file)
@@ -307,7 +307,6 @@ SVal GRSimpleVals::EvalEQ(GRExprEngine& Eng, Loc L, Loc R) {
     
     // Fall-through.
       
-    case loc::FuncValKind:
     case loc::GotoLabelKind:
       return NonLoc::MakeIntTruthVal(BasicVals, L == R);
   }
@@ -356,7 +355,6 @@ SVal GRSimpleVals::EvalNE(GRExprEngine& Eng, Loc L, Loc R) {
       // Fall through:
     }
       
-    case loc::FuncValKind:
     case loc::GotoLabelKind:
       return NonLoc::MakeIntTruthVal(BasicVals, L != R);
   }
index 215fe1c281405c5e88b29ccd2d6774a2ed4a70a9..40f7c481317a40e28bdbec146c137869779cd000 100644 (file)
@@ -365,7 +365,6 @@ SVal RegionStoreManager::getLValueFieldOrIvar(const GRState* St, SVal Base,
     break;
 
   case loc::GotoLabelKind:
-  case loc::FuncValKind:
     // These are anormal cases. Flag an undefined value.
     return UndefinedVal();
 
@@ -662,11 +661,6 @@ SVal RegionStoreManager::Retrieve(const GRState* St, Loc L, QualType T) {
   if (isa<loc::ConcreteInt>(L))
     return UndefinedVal();
 
-  // FIXME: Should this be refactored into GRExprEngine or GRStateManager?
-  //  It seems that all StoreManagers would do the same thing here.
-  if (isa<loc::FuncVal>(L))
-    return L;
-
   const MemRegion* MR = cast<loc::MemRegionVal>(L).getRegion();
 
   // We return unknown for symbolic region for now. This might be improved.
index 875fd36747cece8981a2d3c68f99c58951d56220..8eaeda4b7d575e07d37b4c6809cc71d28a83d60b 100644 (file)
@@ -31,10 +31,6 @@ using llvm::APSInt;
 //===----------------------------------------------------------------------===//
 
 const FunctionDecl* SVal::getAsFunctionDecl() const {
-  if (const loc::FuncVal* FV = dyn_cast<loc::FuncVal>(this)) {
-    return FV->getDecl();
-  }
-
   if (const loc::MemRegionVal* X = dyn_cast<loc::MemRegionVal>(this)) {
     const MemRegion* R = X->getRegion();
     if (const CodeTextRegion* CTR = dyn_cast<CodeTextRegion>(R)) {
@@ -481,11 +477,6 @@ void Loc::print(llvm::raw_ostream& Out) const {
       Out << '&' << cast<loc::MemRegionVal>(this)->getRegion()->getString();
       break;
       
-    case loc::FuncValKind:
-      Out << "function " 
-          << cast<loc::FuncVal>(this)->getDecl()->getIdentifier()->getName();
-      break;
-      
     default:
       assert (false && "Pretty-printing not implemented for this Loc.");
       break;
index feaad191ef4a22a9a6c345bb5e386b09a29547f3..f79dba0cc5eee7be4aa08ce143ab82e1df7f53e1 100644 (file)
@@ -116,7 +116,6 @@ SimpleConstraintManager::AssumeAux(const GRState* St, Loc Cond, bool Assumption,
     // FALL-THROUGH.
   }
       
-  case loc::FuncValKind:
   case loc::GotoLabelKind:
     isFeasible = Assumption;
     return St;