[cfe-commits] r46770 - in /cfe/trunk/Analysis: GRConstants.cpp RValues.cpp RValues.h ValueState.cpp

Ted Kremenek kremenek at apple.com
Tue Feb 5 13:52:22 PST 2008


Author: kremenek
Date: Tue Feb  5 15:52:21 2008
New Revision: 46770

URL: http://llvm.org/viewvc/llvm-project?rev=46770&view=rev
Log:
Moved subclasses of LValue and NonLValue into their own namespaces.
This noticeably cleans up the naming of these classes.

Modified:
    cfe/trunk/Analysis/GRConstants.cpp
    cfe/trunk/Analysis/RValues.cpp
    cfe/trunk/Analysis/RValues.h
    cfe/trunk/Analysis/ValueState.cpp

Modified: cfe/trunk/Analysis/GRConstants.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRConstants.cpp?rev=46770&r1=46769&r2=46770&view=diff

==============================================================================
--- cfe/trunk/Analysis/GRConstants.cpp (original)
+++ cfe/trunk/Analysis/GRConstants.cpp Tue Feb  5 15:52:21 2008
@@ -154,7 +154,7 @@
     
     for (FunctionDecl::param_iterator I=F.param_begin(), E=F.param_end(); 
           I!=E; ++I)
-      St = SetValue(St, LValueDecl(*I), RValue::GetSymbolValue(SymMgr, *I));
+      St = SetValue(St, lval::DeclVal(*I), RValue::GetSymbolValue(SymMgr, *I));
     
     return St;
   }
@@ -540,7 +540,7 @@
   for (const ScopedDecl* D = DS->getDecl(); D; D = D->getNextDeclarator())
     if (const VarDecl* VD = dyn_cast<VarDecl>(D)) {
       const Expr* E = VD->getInit();      
-      St = SetValue(St, LValueDecl(VD),
+      St = SetValue(St, lval::DeclVal(VD),
                     E ? GetValue(St, E) : UninitializedValue());
     }
 
@@ -859,12 +859,12 @@
       assert (false && "'Assume' not implemented for this NonLValue.");
       return St;
       
-    case LValueDeclKind:
+    case lval::DeclValKind:
       isFeasible = Assumption;
       return St;
       
-    case ConcreteIntLValueKind: {
-      bool b = cast<ConcreteIntLValue>(Cond).getValue() != 0;
+    case lval::ConcreteIntKind: {
+      bool b = cast<lval::ConcreteInt>(Cond).getValue() != 0;
       isFeasible = b ? Assumption : !Assumption;      
       return St;
     }
@@ -879,8 +879,8 @@
       assert (false && "'Assume' not implemented for this NonLValue.");
       return St;
       
-    case ConcreteIntKind: {
-      bool b = cast<ConcreteInt>(Cond).getValue() != 0;
+    case nonlval::ConcreteIntKind: {
+      bool b = cast<nonlval::ConcreteInt>(Cond).getValue() != 0;
       isFeasible = b ? Assumption : !Assumption;      
       return St;
     }

Modified: cfe/trunk/Analysis/RValues.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/RValues.cpp?rev=46770&r1=46769&r2=46770&view=diff

==============================================================================
--- cfe/trunk/Analysis/RValues.cpp (original)
+++ cfe/trunk/Analysis/RValues.cpp Tue Feb  5 15:52:21 2008
@@ -122,29 +122,29 @@
   
   assert (CastExpr->getType()->isIntegerType());
 
-  if (!isa<ConcreteIntLValue>(*this))
+  if (!isa<lval::ConcreteInt>(*this))
     return InvalidValue();
   
-  APSInt V = cast<ConcreteIntLValue>(this)->getValue();
+  APSInt V = cast<lval::ConcreteInt>(this)->getValue();
   QualType T = CastExpr->getType();
   V.setIsUnsigned(T->isUnsignedIntegerType());
   V.extOrTrunc(ValMgr.getContext().getTypeSize(T, CastExpr->getLocStart()));
-  return ConcreteInt(ValMgr.getValue(V));
+  return nonlval::ConcreteInt(ValMgr.getValue(V));
 }
 
 RValue NonLValue::Cast(ValueManager& ValMgr, Expr* CastExpr) const {
-  if (!isa<ConcreteInt>(this))
+  if (!isa<nonlval::ConcreteInt>(this))
     return InvalidValue();
     
-  APSInt V = cast<ConcreteInt>(this)->getValue();
+  APSInt V = cast<nonlval::ConcreteInt>(this)->getValue();
   QualType T = CastExpr->getType();
   V.setIsUnsigned(T->isUnsignedIntegerType());
   V.extOrTrunc(ValMgr.getContext().getTypeSize(T, CastExpr->getLocStart()));
   
   if (CastExpr->getType()->isPointerType())
-    return ConcreteIntLValue(ValMgr.getValue(V));
+    return lval::ConcreteInt(ValMgr.getValue(V));
   else
-    return ConcreteInt(ValMgr.getValue(V));
+    return nonlval::ConcreteInt(ValMgr.getValue(V));
 }
 
 //===----------------------------------------------------------------------===//
@@ -153,8 +153,8 @@
 
 NonLValue NonLValue::UnaryMinus(ValueManager& ValMgr, UnaryOperator* U) const {
   switch (getSubKind()) {
-    case ConcreteIntKind:
-      return cast<ConcreteInt>(this)->UnaryMinus(ValMgr, U);
+    case nonlval::ConcreteIntKind:
+      return cast<nonlval::ConcreteInt>(this)->UnaryMinus(ValMgr, U);
     default:
       return cast<NonLValue>(InvalidValue());
   }
@@ -162,8 +162,8 @@
 
 NonLValue NonLValue::BitwiseComplement(ValueManager& ValMgr) const {
   switch (getSubKind()) {
-    case ConcreteIntKind:
-      return cast<ConcreteInt>(this)->BitwiseComplement(ValMgr);
+    case nonlval::ConcreteIntKind:
+      return cast<nonlval::ConcreteInt>(this)->BitwiseComplement(ValMgr);
     default:
       return cast<NonLValue>(InvalidValue());
   }
@@ -171,12 +171,12 @@
 
 
 #define NONLVALUE_DISPATCH_CASE(k1,k2,Op)\
-case (k1##Kind*NumNonLValueKind+k2##Kind):\
+case (k1##Kind*nonlval::NumKind+k2##Kind):\
 return cast<k1>(*this).Op(ValMgr,cast<k2>(RHS));
 
 #define NONLVALUE_DISPATCH(Op)\
-switch (getSubKind()*NumNonLValueKind+RHS.getSubKind()){\
-NONLVALUE_DISPATCH_CASE(ConcreteInt,ConcreteInt,Op)\
+switch (getSubKind()*nonlval::NumKind+RHS.getSubKind()){\
+NONLVALUE_DISPATCH_CASE(nonlval::ConcreteInt,nonlval::ConcreteInt,Op)\
 default:\
 if (getBaseKind() == UninitializedKind ||\
 RHS.getBaseKind() == UninitializedKind)\
@@ -231,15 +231,15 @@
       assert(false && "EQ not implemented for this LValue.");
       return cast<NonLValue>(InvalidValue());
     
-    case ConcreteIntLValueKind: {
-      bool b = cast<ConcreteIntLValue>(this)->getValue() ==
-               cast<ConcreteIntLValue>(RHS).getValue();
+    case lval::ConcreteIntKind: {
+      bool b = cast<lval::ConcreteInt>(this)->getValue() ==
+               cast<lval::ConcreteInt>(RHS).getValue();
             
       return NonLValue::GetIntTruthValue(ValMgr, b);
     }
       
-    case LValueDeclKind: {
-      bool b = cast<LValueDecl>(*this) == cast<LValueDecl>(RHS);
+    case lval::DeclValKind: {
+      bool b = cast<lval::DeclVal>(*this) == cast<lval::DeclVal>(RHS);
       return NonLValue::GetIntTruthValue(ValMgr, b);
     }
   }
@@ -254,15 +254,15 @@
       assert(false && "EQ not implemented for this LValue.");
       return cast<NonLValue>(InvalidValue());
       
-    case ConcreteIntLValueKind: {
-      bool b = cast<ConcreteIntLValue>(this)->getValue() !=
-               cast<ConcreteIntLValue>(RHS).getValue();
+    case lval::ConcreteIntKind: {
+      bool b = cast<lval::ConcreteInt>(this)->getValue() !=
+               cast<lval::ConcreteInt>(RHS).getValue();
       
       return NonLValue::GetIntTruthValue(ValMgr, b);
     }  
       
-    case LValueDeclKind: {
-      bool b = cast<LValueDecl>(*this) != cast<LValueDecl>(RHS);
+    case lval::DeclValKind: {
+      bool b = cast<lval::DeclVal>(*this) != cast<lval::DeclVal>(RHS);
       return NonLValue::GetIntTruthValue(ValMgr, b);
     }
   }
@@ -276,21 +276,21 @@
 NonLValue NonLValue::GetValue(ValueManager& ValMgr, uint64_t X, QualType T,
                               SourceLocation Loc) {
   
-  return ConcreteInt(ValMgr.getValue(X, T, Loc));
+  return nonlval::ConcreteInt(ValMgr.getValue(X, T, Loc));
 }
 
 NonLValue NonLValue::GetValue(ValueManager& ValMgr, IntegerLiteral* I) {
-  return ConcreteInt(ValMgr.getValue(APSInt(I->getValue(),
-                                            I->getType()->isUnsignedIntegerType())));
+  return nonlval::ConcreteInt(ValMgr.getValue(APSInt(I->getValue(),
+                                   I->getType()->isUnsignedIntegerType())));
 }
 
 RValue RValue::GetSymbolValue(SymbolManager& SymMgr, ParmVarDecl* D) {
   QualType T = D->getType();
   
   if (T->isPointerType() || T->isReferenceType())
-    return SymbolicLValue(SymMgr.getSymbol(D));
+    return lval::SymbolVal(SymMgr.getSymbol(D));
   else
-    return SymbolicNonLValue(SymMgr.getSymbol(D));
+    return nonlval::SymbolVal(SymMgr.getSymbol(D));
 }
 
 //===----------------------------------------------------------------------===//
@@ -322,12 +322,12 @@
 
 void NonLValue::print(std::ostream& Out) const {
   switch (getSubKind()) {  
-    case ConcreteIntKind:
-      Out << cast<ConcreteInt>(this)->getValue().toString();
+    case nonlval::ConcreteIntKind:
+      Out << cast<nonlval::ConcreteInt>(this)->getValue().toString();
       break;
       
-    case SymbolicNonLValueKind:
-      Out << '$' << cast<SymbolicNonLValue>(this)->getSymbolID();
+    case nonlval::SymbolValKind:
+      Out << '$' << cast<nonlval::SymbolVal>(this)->getSymbolID();
       break;
       
     default:
@@ -338,18 +338,18 @@
 
 void LValue::print(std::ostream& Out) const {
   switch (getSubKind()) {        
-    case ConcreteIntLValueKind:
-      Out << cast<ConcreteIntLValue>(this)->getValue().toString() 
+    case lval::ConcreteIntKind:
+      Out << cast<lval::ConcreteInt>(this)->getValue().toString() 
           << " (LValue)";
       break;
       
-    case SymbolicLValueKind:
-      Out << '$' << cast<SymbolicLValue>(this)->getSymbolID();
+    case lval::SymbolValKind:
+      Out << '$' << cast<lval::SymbolVal>(this)->getSymbolID();
       break;
       
-    case LValueDeclKind:
+    case lval::DeclValKind:
       Out << '&' 
-      << cast<LValueDecl>(this)->getDecl()->getIdentifier()->getName();
+      << cast<lval::DeclVal>(this)->getDecl()->getIdentifier()->getName();
       break;
       
     default:

Modified: cfe/trunk/Analysis/RValues.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/RValues.h?rev=46770&r1=46769&r2=46770&view=diff

==============================================================================
--- cfe/trunk/Analysis/RValues.h (original)
+++ cfe/trunk/Analysis/RValues.h Tue Feb  5 15:52:21 2008
@@ -298,174 +298,187 @@
 //  Subclasses of NonLValue.
 //==------------------------------------------------------------------------==// 
 
-enum NonLValueKind { SymbolicNonLValueKind, ConcreteIntKind, NumNonLValueKind };
-
-class SymbolicNonLValue : public NonLValue {
-public:
-  SymbolicNonLValue(unsigned SymID)
-  : NonLValue(SymbolicNonLValueKind,
-              reinterpret_cast<void*>((uintptr_t) SymID)) {}
-  
-  SymbolID getSymbolID() const {
-    return (SymbolID) reinterpret_cast<uintptr_t>(getRawPtr());
-  }
-  
-  static inline bool classof(const RValue* V) {
-    return V->getSubKind() == SymbolicNonLValueKind;
-  }  
-};
-
-class ConcreteInt : public NonLValue {
-public:
-  ConcreteInt(const llvm::APSInt& V) : NonLValue(ConcreteIntKind, &V) {}
-  
-  const llvm::APSInt& getValue() const {
-    return *static_cast<llvm::APSInt*>(getRawPtr());
-  }
-  
-  // Arithmetic operators.
-  
-  ConcreteInt Add(ValueManager& ValMgr, const ConcreteInt& V) const {
-    return ValMgr.getValue(getValue() + V.getValue());
-  }
-  
-  ConcreteInt Sub(ValueManager& ValMgr, const ConcreteInt& V) const {
-    return ValMgr.getValue(getValue() - V.getValue());
-  }
-  
-  ConcreteInt Mul(ValueManager& ValMgr, const ConcreteInt& V) const {
-    return ValMgr.getValue(getValue() * V.getValue());
-  }
-  
-  ConcreteInt Div(ValueManager& ValMgr, const ConcreteInt& V) const {
-    return ValMgr.getValue(getValue() / V.getValue());
-  }
-  
-  ConcreteInt Rem(ValueManager& ValMgr, const ConcreteInt& V) const {
-    return ValMgr.getValue(getValue() % V.getValue());
-  }
-  
-  ConcreteInt UnaryMinus(ValueManager& ValMgr, UnaryOperator* U) const {
-    assert (U->getType() == U->getSubExpr()->getType());  
-    assert (U->getType()->isIntegerType());  
-    return ValMgr.getValue(-getValue()); 
-  }
-  
-  ConcreteInt BitwiseComplement(ValueManager& ValMgr) const {
-    return ValMgr.getValue(~getValue()); 
-  }
+namespace nonlval {
   
-  // Casting.
-  
-  ConcreteInt Cast(ValueManager& ValMgr, Expr* CastExpr) const {
-    assert (CastExpr->getType()->isIntegerType());
+  enum Kind { SymbolValKind,
+              SymIntConstraintKind,
+              ConcreteIntKind,
+              NumKind };
+
+  class SymbolVal : public NonLValue {
+  public:
+    SymbolVal(unsigned SymID)
+    : NonLValue(SymbolValKind,
+                reinterpret_cast<void*>((uintptr_t) SymID)) {}
     
-    llvm::APSInt X(getValue());  
-    X.extOrTrunc(ValMgr.getContext().getTypeSize(CastExpr->getType(),
-                                                 CastExpr->getLocStart()));
-    return ValMgr.getValue(X);
-  }
-  
-  // Equality operators.
-  
-  ConcreteInt EQ(ValueManager& ValMgr, const ConcreteInt& V) const {
-    const llvm::APSInt& Val = getValue();    
-    return ValMgr.getValue(Val == V.getValue() ? 1U : 0U,
-                           Val.getBitWidth(), Val.isUnsigned());
-  }
-  
-  ConcreteInt NE(ValueManager& ValMgr, const ConcreteInt& V) const {
-    const llvm::APSInt& Val = getValue();    
-    return ValMgr.getValue(Val != V.getValue() ? 1U : 0U,
-                           Val.getBitWidth(), Val.isUnsigned());
-  }
+    SymbolID getSymbolID() const {
+      return (SymbolID) reinterpret_cast<uintptr_t>(getRawPtr());
+    }
+    
+    static inline bool classof(const RValue* V) {
+      return V->getSubKind() == SymbolValKind;
+    }  
+  };
+
+  class ConcreteInt : public NonLValue {
+  public:
+    ConcreteInt(const llvm::APSInt& V) : NonLValue(ConcreteIntKind, &V) {}
+    
+    const llvm::APSInt& getValue() const {
+      return *static_cast<llvm::APSInt*>(getRawPtr());
+    }
+    
+    // Arithmetic operators.
+    
+    ConcreteInt Add(ValueManager& ValMgr, const ConcreteInt& V) const {
+      return ValMgr.getValue(getValue() + V.getValue());
+    }
+    
+    ConcreteInt Sub(ValueManager& ValMgr, const ConcreteInt& V) const {
+      return ValMgr.getValue(getValue() - V.getValue());
+    }
+    
+    ConcreteInt Mul(ValueManager& ValMgr, const ConcreteInt& V) const {
+      return ValMgr.getValue(getValue() * V.getValue());
+    }
+    
+    ConcreteInt Div(ValueManager& ValMgr, const ConcreteInt& V) const {
+      return ValMgr.getValue(getValue() / V.getValue());
+    }
+    
+    ConcreteInt Rem(ValueManager& ValMgr, const ConcreteInt& V) const {
+      return ValMgr.getValue(getValue() % V.getValue());
+    }
+    
+    ConcreteInt UnaryMinus(ValueManager& ValMgr, UnaryOperator* U) const {
+      assert (U->getType() == U->getSubExpr()->getType());  
+      assert (U->getType()->isIntegerType());  
+      return ValMgr.getValue(-getValue()); 
+    }
+    
+    ConcreteInt BitwiseComplement(ValueManager& ValMgr) const {
+      return ValMgr.getValue(~getValue()); 
+    }
+    
+    // Casting.
+    
+    ConcreteInt Cast(ValueManager& ValMgr, Expr* CastExpr) const {
+      assert (CastExpr->getType()->isIntegerType());
+      
+      llvm::APSInt X(getValue());  
+      X.extOrTrunc(ValMgr.getContext().getTypeSize(CastExpr->getType(),
+                                                   CastExpr->getLocStart()));
+      return ValMgr.getValue(X);
+    }
+    
+    // Equality operators.
+    
+    ConcreteInt EQ(ValueManager& ValMgr, const ConcreteInt& V) const {
+      const llvm::APSInt& Val = getValue();    
+      return ValMgr.getValue(Val == V.getValue() ? 1U : 0U,
+                             Val.getBitWidth(), Val.isUnsigned());
+    }
+    
+    ConcreteInt NE(ValueManager& ValMgr, const ConcreteInt& V) const {
+      const llvm::APSInt& Val = getValue();    
+      return ValMgr.getValue(Val != V.getValue() ? 1U : 0U,
+                             Val.getBitWidth(), Val.isUnsigned());
+    }
+    
+    // Implement isa<T> support.
+    static inline bool classof(const RValue* V) {
+      return V->getSubKind() == ConcreteIntKind;
+    }
+  };
   
-  // Implement isa<T> support.
-  static inline bool classof(const RValue* V) {
-    return V->getSubKind() == ConcreteIntKind;
-  }
-};
+} // end namespace clang::nonlval
 
 //==------------------------------------------------------------------------==//
 //  Subclasses of LValue.
 //==------------------------------------------------------------------------==// 
 
-enum LValueKind { SymbolicLValueKind, LValueDeclKind, ConcreteIntLValueKind,
-                  NumLValueKind };
-  
-class SymbolicLValue : public LValue {
-public:
-  SymbolicLValue(unsigned SymID)
-  : LValue(SymbolicLValueKind, reinterpret_cast<void*>((uintptr_t) SymID)) {}
-  
-  SymbolID getSymbolID() const {
-    return (SymbolID) reinterpret_cast<uintptr_t>(getRawPtr());
-  }
-  
-  static inline bool classof(const RValue* V) {
-    return V->getSubKind() == SymbolicLValueKind;
-  }  
-};
-
-class LValueDecl : public LValue {
-public:
-  LValueDecl(const ValueDecl* vd) : LValue(LValueDeclKind,vd) {}
+namespace lval {
   
-  ValueDecl* getDecl() const {
-    return static_cast<ValueDecl*>(getRawPtr());
-  }
-  
-  inline bool operator==(const LValueDecl& R) const {
-    return getDecl() == R.getDecl();
-  }
-  
-  inline bool operator!=(const LValueDecl& R) const {
-    return getDecl() != R.getDecl();
-  }
-  
-  // Implement isa<T> support.
-  static inline bool classof(const RValue* V) {
-    return V->getSubKind() == LValueDeclKind;
-  }
-};
-
-class ConcreteIntLValue : public LValue {
-public:
-  ConcreteIntLValue(const llvm::APSInt& V) : LValue(ConcreteIntLValueKind, &V) {}
-  
-  const llvm::APSInt& getValue() const {
-    return *static_cast<llvm::APSInt*>(getRawPtr());
-  }
-  
-  // Arithmetic operators.
-  
-  ConcreteIntLValue Add(ValueManager& ValMgr, const ConcreteInt& V) const {
-    return ValMgr.getValue(getValue() + V.getValue());
-  }
-  
-  ConcreteIntLValue Sub(ValueManager& ValMgr, const ConcreteInt& V) const {
-    return ValMgr.getValue(getValue() - V.getValue());
-  }
-  
-  // Equality operators.
-  
-  ConcreteInt EQ(ValueManager& ValMgr, const ConcreteIntLValue& V) const {
-    const llvm::APSInt& Val = getValue();    
-    return ValMgr.getValue(Val == V.getValue() ? 1U : 0U,
-                           Val.getBitWidth(), Val.isUnsigned());
-  }
-  
-  ConcreteInt NE(ValueManager& ValMgr, const ConcreteIntLValue& V) const {
-    const llvm::APSInt& Val = getValue();    
-    return ValMgr.getValue(Val != V.getValue() ? 1U : 0U,
-                           Val.getBitWidth(), Val.isUnsigned());
-  }
+  enum Kind { SymbolValKind,
+              DeclValKind,
+              ConcreteIntKind,
+              NumKind };
+  
+  class SymbolVal : public LValue {
+  public:
+    SymbolVal(unsigned SymID)
+    : LValue(SymbolValKind, reinterpret_cast<void*>((uintptr_t) SymID)) {}
+    
+    SymbolID getSymbolID() const {
+      return (SymbolID) reinterpret_cast<uintptr_t>(getRawPtr());
+    }
+    
+    static inline bool classof(const RValue* V) {
+      return V->getSubKind() == SymbolValKind;
+    }  
+  };
+
+  class DeclVal : public LValue {
+  public:
+    DeclVal(const ValueDecl* vd) : LValue(DeclValKind,vd) {}
+    
+    ValueDecl* getDecl() const {
+      return static_cast<ValueDecl*>(getRawPtr());
+    }
+    
+    inline bool operator==(const DeclVal& R) const {
+      return getDecl() == R.getDecl();
+    }
+    
+    inline bool operator!=(const DeclVal& R) const {
+      return getDecl() != R.getDecl();
+    }
+    
+    // Implement isa<T> support.
+    static inline bool classof(const RValue* V) {
+      return V->getSubKind() == DeclValKind;
+    }
+  };
+
+  class ConcreteInt : public LValue {
+  public:
+    ConcreteInt(const llvm::APSInt& V) : LValue(ConcreteIntKind, &V) {}
+    
+    const llvm::APSInt& getValue() const {
+      return *static_cast<llvm::APSInt*>(getRawPtr());
+    }
+    
+    // Arithmetic operators.
+    
+    ConcreteInt Add(ValueManager& ValMgr, const ConcreteInt& V) const {
+      return ValMgr.getValue(getValue() + V.getValue());
+    }
+    
+    ConcreteInt Sub(ValueManager& ValMgr, const ConcreteInt& V) const {
+      return ValMgr.getValue(getValue() - V.getValue());
+    }
+    
+    // Equality operators.
+    
+    ConcreteInt EQ(ValueManager& ValMgr, const ConcreteInt& V) const {
+      const llvm::APSInt& Val = getValue();    
+      return ValMgr.getValue(Val == V.getValue() ? 1U : 0U,
+                             Val.getBitWidth(), Val.isUnsigned());
+    }
+    
+    ConcreteInt NE(ValueManager& ValMgr, const ConcreteInt& V) const {
+      const llvm::APSInt& Val = getValue();    
+      return ValMgr.getValue(Val != V.getValue() ? 1U : 0U,
+                             Val.getBitWidth(), Val.isUnsigned());
+    }
+    
+    // Implement isa<T> support.
+    static inline bool classof(const RValue* V) {
+      return V->getSubKind() == ConcreteIntKind;
+    }
+  };  
+} // end clang::lval namespace
   
-  // Implement isa<T> support.
-  static inline bool classof(const RValue* V) {
-    return V->getSubKind() == ConcreteIntLValueKind;
-  }
-};  
   
 } // end clang namespace  
 

Modified: cfe/trunk/Analysis/ValueState.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/ValueState.cpp?rev=46770&r1=46769&r2=46770&view=diff

==============================================================================
--- cfe/trunk/Analysis/ValueState.cpp (original)
+++ cfe/trunk/Analysis/ValueState.cpp Tue Feb  5 15:52:21 2008
@@ -17,9 +17,9 @@
 
 RValue ValueStateManager::GetValue(const StateTy& St, const LValue& LV) {
   switch (LV.getSubKind()) {
-    case LValueDeclKind: {
+    case lval::DeclValKind: {
       StateTy::VariableBindingsTy::TreeTy* T =
-        St.getImpl()->VariableBindings.SlimFind(cast<LValueDecl>(LV).getDecl());
+        St.getImpl()->VariableBindings.SlimFind(cast<lval::DeclVal>(LV).getDecl());
       
       return T ? T->getValue().second : InvalidValue();
     }
@@ -47,7 +47,7 @@
         // within the referenced variables.
         
       case Stmt::DeclRefExprClass:
-        return GetValue(St, LValueDecl(cast<DeclRefExpr>(S)->getDecl()));
+        return GetValue(St, lval::DeclVal(cast<DeclRefExpr>(S)->getDecl()));
         
         // Integer literals evaluate to an RValue.  Simply retrieve the
         // RValue for the literal.
@@ -105,7 +105,7 @@
     S = P->getSubExpr();
   
   if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(S))
-    return LValueDecl(DR->getDecl());
+    return lval::DeclVal(DR->getDecl());
   
   return cast<LValue>(GetValue(St, S));
 }
@@ -123,9 +123,9 @@
 ValueStateManager::SetValue(StateTy St, const LValue& LV, const RValue& V) {
   
   switch (LV.getSubKind()) {
-    case LValueDeclKind:        
-      return V.isValid() ? Add(St, cast<LValueDecl>(LV).getDecl(), V)
-                         : Remove(St, cast<LValueDecl>(LV).getDecl());
+    case lval::DeclValKind:        
+      return V.isValid() ? Add(St, cast<lval::DeclVal>(LV).getDecl(), V)
+                         : Remove(St, cast<lval::DeclVal>(LV).getDecl());
       
     default:
       assert ("SetValue for given LValue type not yet implemented.");





More information about the cfe-commits mailing list