[cfe-commits] r48025 - in /cfe/trunk: Analysis/ clang.xcodeproj/ include/clang/Analysis/PathSensitive/

Ted Kremenek kremenek at apple.com
Fri Mar 7 12:13:31 PST 2008


Author: kremenek
Date: Fri Mar  7 14:13:31 2008
New Revision: 48025

URL: http://llvm.org/viewvc/llvm-project?rev=48025&view=rev
Log:
Renamed ValueManager to BasicValueFactory.

Added:
    cfe/trunk/Analysis/BasicValueFactory.cpp
      - copied, changed from r48016, cfe/trunk/Analysis/ValueManager.cpp
    cfe/trunk/include/clang/Analysis/PathSensitive/BasicValueFactory.h
      - copied, changed from r48016, cfe/trunk/include/clang/Analysis/PathSensitive/ValueManager.h
Removed:
    cfe/trunk/Analysis/ValueManager.cpp
    cfe/trunk/include/clang/Analysis/PathSensitive/ValueManager.h
Modified:
    cfe/trunk/Analysis/CFRefCount.cpp
    cfe/trunk/Analysis/CFRefCount.h
    cfe/trunk/Analysis/GRExprEngine.cpp
    cfe/trunk/Analysis/GRSimpleVals.cpp
    cfe/trunk/Analysis/GRSimpleVals.h
    cfe/trunk/Analysis/RValues.cpp
    cfe/trunk/Analysis/ValueState.cpp
    cfe/trunk/clang.xcodeproj/project.pbxproj
    cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h
    cfe/trunk/include/clang/Analysis/PathSensitive/GRTransferFuncs.h
    cfe/trunk/include/clang/Analysis/PathSensitive/RValues.h
    cfe/trunk/include/clang/Analysis/PathSensitive/ValueState.h

Copied: cfe/trunk/Analysis/BasicValueFactory.cpp (from r48016, cfe/trunk/Analysis/ValueManager.cpp)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/BasicValueFactory.cpp?p2=cfe/trunk/Analysis/BasicValueFactory.cpp&p1=cfe/trunk/Analysis/ValueManager.cpp&r1=48016&r2=48025&rev=48025&view=diff

==============================================================================
--- cfe/trunk/Analysis/ValueManager.cpp (original)
+++ cfe/trunk/Analysis/BasicValueFactory.cpp Fri Mar  7 14:13:31 2008
@@ -1,4 +1,4 @@
-// ValueManager.h - Low-level value management for Value Tracking -*- C++ -*--==
+//=== BasicValueFactory.cpp - Basic values for Path Sens analysis --*- C++ -*-//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,16 +7,17 @@
 //
 //===----------------------------------------------------------------------===//
 //
-//  This file defines ValueManager, a class that manages the lifetime of APSInt
-//  objects and symbolic constraints used by GRExprEngine and related classes.
+//  This file defines BasicValueFactory, a class that manages the lifetime
+//  of APSInt objects and symbolic constraints used by GRExprEngine 
+//  and related classes.
 //
 //===----------------------------------------------------------------------===//
 
-#include "clang/Analysis/PathSensitive/ValueManager.h"
+#include "clang/Analysis/PathSensitive/BasicValueFactory.h"
 
 using namespace clang;
 
-ValueManager::~ValueManager() {
+BasicValueFactory::~BasicValueFactory() {
   // Note that the dstor for the contents of APSIntSet will never be called,
   // so we iterate over the set and invoke the dstor for each APSInt.  This
   // frees an aux. memory allocated to represent very large constants.
@@ -24,7 +25,7 @@
     I->getValue().~APSInt();
 }
 
-const llvm::APSInt& ValueManager::getValue(const llvm::APSInt& X) {
+const llvm::APSInt& BasicValueFactory::getValue(const llvm::APSInt& X) {
   llvm::FoldingSetNodeID ID;
   void* InsertPos;
   typedef llvm::FoldingSetNodeWrapper<llvm::APSInt> FoldNodeTy;
@@ -41,14 +42,14 @@
   return *P;
 }
 
-const llvm::APSInt& ValueManager::getValue(uint64_t X, unsigned BitWidth,
+const llvm::APSInt& BasicValueFactory::getValue(uint64_t X, unsigned BitWidth,
                                            bool isUnsigned) {
   llvm::APSInt V(BitWidth, isUnsigned);
   V = X;  
   return getValue(V);
 }
 
-const llvm::APSInt& ValueManager::getValue(uint64_t X, QualType T) {
+const llvm::APSInt& BasicValueFactory::getValue(uint64_t X, QualType T) {
   
   unsigned bits = Ctx.getTypeSize(T);
   llvm::APSInt V(bits, T->isUnsignedIntegerType());
@@ -57,7 +58,7 @@
 }
 
 const SymIntConstraint&
-ValueManager::getConstraint(SymbolID sym, BinaryOperator::Opcode Op,
+BasicValueFactory::getConstraint(SymbolID sym, BinaryOperator::Opcode Op,
                             const llvm::APSInt& V) {
   
   llvm::FoldingSetNodeID ID;
@@ -76,7 +77,7 @@
 }
 
 const llvm::APSInt*
-ValueManager::EvaluateAPSInt(BinaryOperator::Opcode Op,
+BasicValueFactory::EvaluateAPSInt(BinaryOperator::Opcode Op,
                              const llvm::APSInt& V1, const llvm::APSInt& V2) {
   
   switch (Op) {

Modified: cfe/trunk/Analysis/CFRefCount.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/CFRefCount.cpp?rev=48025&r1=48024&r2=48025&view=diff

==============================================================================
--- cfe/trunk/Analysis/CFRefCount.cpp (original)
+++ cfe/trunk/Analysis/CFRefCount.cpp Fri Mar  7 14:13:31 2008
@@ -44,7 +44,7 @@
 void CFRefCount::EvalCall(ExplodedNodeSet<ValueState>& Dst,
                             ValueStateManager& StateMgr,
                             GRStmtNodeBuilder<ValueState>& Builder,
-                            ValueManager& ValMgr,
+                            BasicValueFactory& BasicVals,
                             CallExpr* CE, LVal L,
                             ExplodedNode<ValueState>* Pred) {
   

Modified: cfe/trunk/Analysis/CFRefCount.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/CFRefCount.h?rev=48025&r1=48024&r2=48025&view=diff

==============================================================================
--- cfe/trunk/Analysis/CFRefCount.h (original)
+++ cfe/trunk/Analysis/CFRefCount.h Fri Mar  7 14:13:31 2008
@@ -29,7 +29,7 @@
   virtual void EvalCall(ExplodedNodeSet<ValueState>& Dst,
                         ValueStateManager& StateMgr,
                         GRStmtNodeBuilder<ValueState>& Builder,
-                        ValueManager& ValMgr,
+                        BasicValueFactory& BasicVals,
                         CallExpr* CE, LVal L,
                         ExplodedNode<ValueState>* Pred);  
 };

Modified: cfe/trunk/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRExprEngine.cpp?rev=48025&r1=48024&r2=48025&view=diff

==============================================================================
--- cfe/trunk/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/Analysis/GRExprEngine.cpp Fri Mar  7 14:13:31 2008
@@ -308,7 +308,7 @@
     //  This should be easy once we have "ranges" for NonLVals.
         
     do {      
-      nonlval::ConcreteInt CaseVal(ValMgr.getValue(V1));
+      nonlval::ConcreteInt CaseVal(BasicVals.getValue(V1));
       
       RVal Res = EvalBinOp(BinaryOperator::EQ, CondV, CaseVal);
       
@@ -657,12 +657,12 @@
           if (T->isPointerType()) {
             
             St = SetRVal(St, lval::DeclVal(VD),
-                         lval::ConcreteInt(ValMgr.getValue(0, T)));
+                         lval::ConcreteInt(BasicVals.getValue(0, T)));
           }
           else if (T->isIntegerType()) {
             
             St = SetRVal(St, lval::DeclVal(VD),
-                         nonlval::ConcreteInt(ValMgr.getValue(0, T)));
+                         nonlval::ConcreteInt(BasicVals.getValue(0, T)));
           }
           
 
@@ -727,7 +727,7 @@
   
   Nodify(Dst, Ex, Pred,
          SetRVal(Pred->getState(), Ex,
-                  NonLVal::MakeVal(ValMgr, size, Ex->getType())));
+                  NonLVal::MakeVal(BasicVals, size, Ex->getType())));
   
 }
 
@@ -917,13 +917,13 @@
         //    transfer functions as "0 == E".
 
         if (isa<LVal>(SubV)) {
-          lval::ConcreteInt V(ValMgr.getZeroWithPtrWidth());
+          lval::ConcreteInt V(BasicVals.getZeroWithPtrWidth());
           RVal Result = EvalBinOp(BinaryOperator::EQ, cast<LVal>(SubV), V);
           St = SetRVal(St, U, Result);
         }
         else {
           Expr* Ex = U->getSubExpr();
-          nonlval::ConcreteInt V(ValMgr.getValue(0, Ex->getType()));
+          nonlval::ConcreteInt V(BasicVals.getValue(0, Ex->getType()));
           RVal Result = EvalBinOp(BinaryOperator::EQ, cast<NonLVal>(SubV), V);
           St = SetRVal(St, U, Result);
         }
@@ -955,7 +955,7 @@
   
   uint64_t size = getContext().getTypeSize(T) / 8;                
   ValueState* St = Pred->getState();
-  St = SetRVal(St, U, NonLVal::MakeVal(ValMgr, size, U->getType()));
+  St = SetRVal(St, U, NonLVal::MakeVal(BasicVals, size, U->getType()));
 
   Nodify(Dst, U, Pred, St);
 }
@@ -1433,10 +1433,10 @@
     case lval::SymbolValKind:
       if (Assumption)
         return AssumeSymNE(St, cast<lval::SymbolVal>(Cond).getSymbol(),
-                           ValMgr.getZeroWithPtrWidth(), isFeasible);
+                           BasicVals.getZeroWithPtrWidth(), isFeasible);
       else
         return AssumeSymEQ(St, cast<lval::SymbolVal>(Cond).getSymbol(),
-                           ValMgr.getZeroWithPtrWidth(), isFeasible);
+                           BasicVals.getZeroWithPtrWidth(), isFeasible);
       
       
     case lval::DeclValKind:
@@ -1467,10 +1467,10 @@
       SymbolID sym = SV.getSymbol();
       
       if (Assumption)
-        return AssumeSymNE(St, sym, ValMgr.getValue(0, SymMgr.getType(sym)),
+        return AssumeSymNE(St, sym, BasicVals.getValue(0, SymMgr.getType(sym)),
                            isFeasible);
       else
-        return AssumeSymEQ(St, sym, ValMgr.getValue(0, SymMgr.getType(sym)),
+        return AssumeSymEQ(St, sym, BasicVals.getValue(0, SymMgr.getType(sym)),
                            isFeasible);
     }
       

Modified: cfe/trunk/Analysis/GRSimpleVals.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRSimpleVals.cpp?rev=48025&r1=48024&r2=48025&view=diff

==============================================================================
--- cfe/trunk/Analysis/GRSimpleVals.cpp (original)
+++ cfe/trunk/Analysis/GRSimpleVals.cpp Fri Mar  7 14:13:31 2008
@@ -153,24 +153,24 @@
 // Transfer function for Casts.
 //===----------------------------------------------------------------------===//
 
-RVal GRSimpleVals::EvalCast(ValueManager& ValMgr, NonLVal X, QualType T) {
+RVal GRSimpleVals::EvalCast(BasicValueFactory& BasicVals, NonLVal X, QualType T) {
   
   if (!isa<nonlval::ConcreteInt>(X))
     return UnknownVal();
   
   llvm::APSInt V = cast<nonlval::ConcreteInt>(X).getValue();
   V.setIsUnsigned(T->isUnsignedIntegerType() || T->isPointerType());
-  V.extOrTrunc(ValMgr.getContext().getTypeSize(T));
+  V.extOrTrunc(BasicVals.getContext().getTypeSize(T));
   
   if (T->isPointerType())
-    return lval::ConcreteInt(ValMgr.getValue(V));
+    return lval::ConcreteInt(BasicVals.getValue(V));
   else
-    return nonlval::ConcreteInt(ValMgr.getValue(V));
+    return nonlval::ConcreteInt(BasicVals.getValue(V));
 }
 
 // Casts.
 
-RVal GRSimpleVals::EvalCast(ValueManager& ValMgr, LVal X, QualType T) {
+RVal GRSimpleVals::EvalCast(BasicValueFactory& BasicVals, LVal X, QualType T) {
   
   if (T->isPointerType() || T->isReferenceType())
     return X;
@@ -182,31 +182,31 @@
   
   llvm::APSInt V = cast<lval::ConcreteInt>(X).getValue();
   V.setIsUnsigned(T->isUnsignedIntegerType() || T->isPointerType());
-  V.extOrTrunc(ValMgr.getContext().getTypeSize(T));
+  V.extOrTrunc(BasicVals.getContext().getTypeSize(T));
 
-  return nonlval::ConcreteInt(ValMgr.getValue(V));
+  return nonlval::ConcreteInt(BasicVals.getValue(V));
 }
 
 // Unary operators.
 
-RVal GRSimpleVals::EvalMinus(ValueManager& ValMgr, UnaryOperator* U, NonLVal X){
+RVal GRSimpleVals::EvalMinus(BasicValueFactory& BasicVals, UnaryOperator* U, NonLVal X){
   
   switch (X.getSubKind()) {
       
     case nonlval::ConcreteIntKind:
-      return cast<nonlval::ConcreteInt>(X).EvalMinus(ValMgr, U);
+      return cast<nonlval::ConcreteInt>(X).EvalMinus(BasicVals, U);
       
     default:
       return UnknownVal();
   }
 }
 
-RVal GRSimpleVals::EvalComplement(ValueManager& ValMgr, NonLVal X) {
+RVal GRSimpleVals::EvalComplement(BasicValueFactory& BasicVals, NonLVal X) {
 
   switch (X.getSubKind()) {
       
     case nonlval::ConcreteIntKind:
-      return cast<nonlval::ConcreteInt>(X).EvalComplement(ValMgr);
+      return cast<nonlval::ConcreteInt>(X).EvalComplement(BasicVals);
       
     default:
       return UnknownVal();
@@ -215,7 +215,7 @@
 
 // Binary operators.
 
-RVal GRSimpleVals::EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
+RVal GRSimpleVals::EvalBinOp(BasicValueFactory& BasicVals, BinaryOperator::Opcode Op,
                              NonLVal L, NonLVal R)  {  
   while (1) {
     
@@ -228,7 +228,7 @@
         if (isa<nonlval::ConcreteInt>(R)) {          
           const nonlval::ConcreteInt& L_CI = cast<nonlval::ConcreteInt>(L);
           const nonlval::ConcreteInt& R_CI = cast<nonlval::ConcreteInt>(R);          
-          return L_CI.EvalBinOp(ValMgr, Op, R_CI);          
+          return L_CI.EvalBinOp(BasicVals, Op, R_CI);          
         }
         else {
           NonLVal tmp = R;
@@ -241,7 +241,7 @@
         
         if (isa<nonlval::ConcreteInt>(R)) {
           const SymIntConstraint& C =
-            ValMgr.getConstraint(cast<nonlval::SymbolVal>(L).getSymbol(), Op,
+            BasicVals.getConstraint(cast<nonlval::SymbolVal>(L).getSymbol(), Op,
                                  cast<nonlval::ConcreteInt>(R).getValue());
           
           return nonlval::SymIntConstraintVal(C);
@@ -256,7 +256,7 @@
 
 // Binary Operators (except assignments and comma).
 
-RVal GRSimpleVals::EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
+RVal GRSimpleVals::EvalBinOp(BasicValueFactory& BasicVals, BinaryOperator::Opcode Op,
                              LVal L, LVal R) {
   
   switch (Op) {
@@ -265,23 +265,23 @@
       return UnknownVal();
       
     case BinaryOperator::EQ:
-      return EvalEQ(ValMgr, L, R);
+      return EvalEQ(BasicVals, L, R);
       
     case BinaryOperator::NE:
-      return EvalNE(ValMgr, L, R);      
+      return EvalNE(BasicVals, L, R);      
   }
 }
 
 // Pointer arithmetic.
 
-RVal GRSimpleVals::EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
+RVal GRSimpleVals::EvalBinOp(BasicValueFactory& BasicVals, BinaryOperator::Opcode Op,
                              LVal L, NonLVal R) {  
   return UnknownVal();
 }
 
 // Equality operators for LVals.
 
-RVal GRSimpleVals::EvalEQ(ValueManager& ValMgr, LVal L, LVal R) {
+RVal GRSimpleVals::EvalEQ(BasicValueFactory& BasicVals, LVal L, LVal R) {
   
   switch (L.getSubKind()) {
 
@@ -295,12 +295,12 @@
         bool b = cast<lval::ConcreteInt>(L).getValue() ==
                  cast<lval::ConcreteInt>(R).getValue();
         
-        return NonLVal::MakeIntTruthVal(ValMgr, b);
+        return NonLVal::MakeIntTruthVal(BasicVals, b);
       }
       else if (isa<lval::SymbolVal>(R)) {
         
         const SymIntConstraint& C =
-          ValMgr.getConstraint(cast<lval::SymbolVal>(R).getSymbol(),
+          BasicVals.getConstraint(cast<lval::SymbolVal>(R).getSymbol(),
                                BinaryOperator::EQ,
                                cast<lval::ConcreteInt>(L).getValue());
         
@@ -313,7 +313,7 @@
 
       if (isa<lval::ConcreteInt>(R)) {          
         const SymIntConstraint& C =
-          ValMgr.getConstraint(cast<lval::SymbolVal>(L).getSymbol(),
+          BasicVals.getConstraint(cast<lval::SymbolVal>(L).getSymbol(),
                                BinaryOperator::EQ,
                                cast<lval::ConcreteInt>(R).getValue());
         
@@ -331,13 +331,13 @@
     case lval::DeclValKind:
     case lval::FuncValKind:
     case lval::GotoLabelKind:
-      return NonLVal::MakeIntTruthVal(ValMgr, L == R);
+      return NonLVal::MakeIntTruthVal(BasicVals, L == R);
   }
   
-  return NonLVal::MakeIntTruthVal(ValMgr, false);
+  return NonLVal::MakeIntTruthVal(BasicVals, false);
 }
 
-RVal GRSimpleVals::EvalNE(ValueManager& ValMgr, LVal L, LVal R) {
+RVal GRSimpleVals::EvalNE(BasicValueFactory& BasicVals, LVal L, LVal R) {
   
   switch (L.getSubKind()) {
 
@@ -351,11 +351,11 @@
         bool b = cast<lval::ConcreteInt>(L).getValue() !=
                  cast<lval::ConcreteInt>(R).getValue();
         
-        return NonLVal::MakeIntTruthVal(ValMgr, b);
+        return NonLVal::MakeIntTruthVal(BasicVals, b);
       }
       else if (isa<lval::SymbolVal>(R)) {        
         const SymIntConstraint& C =
-          ValMgr.getConstraint(cast<lval::SymbolVal>(R).getSymbol(),
+          BasicVals.getConstraint(cast<lval::SymbolVal>(R).getSymbol(),
                                BinaryOperator::NE,
                                cast<lval::ConcreteInt>(L).getValue());
         
@@ -367,7 +367,7 @@
     case lval::SymbolValKind: {
       if (isa<lval::ConcreteInt>(R)) {          
         const SymIntConstraint& C =
-          ValMgr.getConstraint(cast<lval::SymbolVal>(L).getSymbol(),
+          BasicVals.getConstraint(cast<lval::SymbolVal>(L).getSymbol(),
                                BinaryOperator::NE,
                                cast<lval::ConcreteInt>(R).getValue());
         
@@ -387,10 +387,10 @@
     case lval::DeclValKind:
     case lval::FuncValKind:
     case lval::GotoLabelKind:
-      return NonLVal::MakeIntTruthVal(ValMgr, L != R);
+      return NonLVal::MakeIntTruthVal(BasicVals, L != R);
   }
   
-  return NonLVal::MakeIntTruthVal(ValMgr, true);
+  return NonLVal::MakeIntTruthVal(BasicVals, true);
 }
 
 //===----------------------------------------------------------------------===//
@@ -400,7 +400,7 @@
 void GRSimpleVals::EvalCall(ExplodedNodeSet<ValueState>& Dst,
                             ValueStateManager& StateMgr,
                             GRStmtNodeBuilder<ValueState>& Builder,
-                            ValueManager& ValMgr,
+                            BasicValueFactory& BasicVals,
                             CallExpr* CE, LVal L,
                             ExplodedNode<ValueState>* Pred) {
   

Modified: cfe/trunk/Analysis/GRSimpleVals.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRSimpleVals.h?rev=48025&r1=48024&r2=48025&view=diff

==============================================================================
--- cfe/trunk/Analysis/GRSimpleVals.h (original)
+++ cfe/trunk/Analysis/GRSimpleVals.h Fri Mar  7 14:13:31 2008
@@ -28,26 +28,26 @@
   
   // Casts.
   
-  virtual RVal EvalCast(ValueManager& ValMgr, NonLVal V, QualType CastT);
-  virtual RVal EvalCast(ValueManager& ValMgr, LVal V, QualType CastT);
+  virtual RVal EvalCast(BasicValueFactory& BasicVals, NonLVal V, QualType CastT);
+  virtual RVal EvalCast(BasicValueFactory& BasicVals, LVal V, QualType CastT);
   
   // Unary Operators.
   
-  virtual RVal EvalMinus(ValueManager& ValMgr, UnaryOperator* U, NonLVal X);
+  virtual RVal EvalMinus(BasicValueFactory& BasicVals, UnaryOperator* U, NonLVal X);
 
-  virtual RVal EvalComplement(ValueManager& ValMgr, NonLVal X);
+  virtual RVal EvalComplement(BasicValueFactory& BasicVals, NonLVal X);
   
   // Binary Operators.
   
-  virtual RVal EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
+  virtual RVal EvalBinOp(BasicValueFactory& BasicVals, BinaryOperator::Opcode Op,
                          NonLVal L, NonLVal R);
   
-  virtual RVal EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
+  virtual RVal EvalBinOp(BasicValueFactory& BasicVals, BinaryOperator::Opcode Op,
                          LVal L, LVal R);
   
   // Pointer arithmetic.
   
-  virtual RVal EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
+  virtual RVal EvalBinOp(BasicValueFactory& BasicVals, BinaryOperator::Opcode Op,
                          LVal L, NonLVal R);  
   
   // Calls.
@@ -55,7 +55,7 @@
   virtual void EvalCall(ExplodedNodeSet<ValueState>& Dst,
                         ValueStateManager& StateMgr,
                         GRStmtNodeBuilder<ValueState>& Builder,
-                        ValueManager& ValMgr,
+                        BasicValueFactory& BasicVals,
                         CallExpr* CE, LVal L,
                         ExplodedNode<ValueState>* Pred);
   
@@ -63,8 +63,8 @@
   
   // Equality operators for LVals.
   
-  RVal EvalEQ(ValueManager& ValMgr, LVal L, LVal R);
-  RVal EvalNE(ValueManager& ValMgr, LVal L, LVal R);
+  RVal EvalEQ(BasicValueFactory& BasicVals, LVal L, LVal R);
+  RVal EvalNE(BasicValueFactory& BasicVals, LVal L, LVal R);
 };
   
 } // end clang namespace

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

==============================================================================
--- cfe/trunk/Analysis/RValues.cpp (original)
+++ cfe/trunk/Analysis/RValues.cpp Fri Mar  7 14:13:31 2008
@@ -49,10 +49,10 @@
 //===----------------------------------------------------------------------===//
 
 RVal
-nonlval::ConcreteInt::EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
+nonlval::ConcreteInt::EvalBinOp(BasicValueFactory& BasicVals, BinaryOperator::Opcode Op,
                                 const nonlval::ConcreteInt& R) const {
   
-  const llvm::APSInt* X = ValMgr.EvaluateAPSInt(Op, getValue(), R.getValue());
+  const llvm::APSInt* X = BasicVals.EvaluateAPSInt(Op, getValue(), R.getValue());
   
   if (X)
     return nonlval::ConcreteInt(*X);
@@ -64,17 +64,17 @@
   // Bitwise-Complement.
 
 nonlval::ConcreteInt
-nonlval::ConcreteInt::EvalComplement(ValueManager& ValMgr) const {
-  return ValMgr.getValue(~getValue()); 
+nonlval::ConcreteInt::EvalComplement(BasicValueFactory& BasicVals) const {
+  return BasicVals.getValue(~getValue()); 
 }
 
   // Unary Minus.
 
 nonlval::ConcreteInt
-nonlval::ConcreteInt::EvalMinus(ValueManager& ValMgr, UnaryOperator* U) const {
+nonlval::ConcreteInt::EvalMinus(BasicValueFactory& BasicVals, UnaryOperator* U) const {
   assert (U->getType() == U->getSubExpr()->getType());  
   assert (U->getType()->isIntegerType());  
-  return ValMgr.getValue(-getValue()); 
+  return BasicVals.getValue(-getValue()); 
 }
 
 //===----------------------------------------------------------------------===//
@@ -82,13 +82,13 @@
 //===----------------------------------------------------------------------===//
 
 RVal
-lval::ConcreteInt::EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
+lval::ConcreteInt::EvalBinOp(BasicValueFactory& BasicVals, BinaryOperator::Opcode Op,
                              const lval::ConcreteInt& R) const {
   
   assert (Op == BinaryOperator::Add || Op == BinaryOperator::Sub ||
           (Op >= BinaryOperator::LT && Op <= BinaryOperator::NE));
   
-  const llvm::APSInt* X = ValMgr.EvaluateAPSInt(Op, getValue(), R.getValue());
+  const llvm::APSInt* X = BasicVals.EvaluateAPSInt(Op, getValue(), R.getValue());
   
   if (X)
     return lval::ConcreteInt(*X);
@@ -96,7 +96,7 @@
     return UndefinedVal();
 }
 
-NonLVal LVal::EQ(ValueManager& ValMgr, const LVal& R) const {
+NonLVal LVal::EQ(BasicValueFactory& BasicVals, const LVal& R) const {
   
   switch (getSubKind()) {
     default:
@@ -108,12 +108,12 @@
         bool b = cast<lval::ConcreteInt>(this)->getValue() ==
                  cast<lval::ConcreteInt>(R).getValue();
         
-        return NonLVal::MakeIntTruthVal(ValMgr, b);
+        return NonLVal::MakeIntTruthVal(BasicVals, b);
       }
       else if (isa<lval::SymbolVal>(R)) {
         
         const SymIntConstraint& C =
-          ValMgr.getConstraint(cast<lval::SymbolVal>(R).getSymbol(),
+          BasicVals.getConstraint(cast<lval::SymbolVal>(R).getSymbol(),
                                BinaryOperator::EQ,
                                cast<lval::ConcreteInt>(this)->getValue());
         
@@ -126,7 +126,7 @@
         if (isa<lval::ConcreteInt>(R)) {
           
           const SymIntConstraint& C =
-            ValMgr.getConstraint(cast<lval::SymbolVal>(this)->getSymbol(),
+            BasicVals.getConstraint(cast<lval::SymbolVal>(this)->getSymbol(),
                                  BinaryOperator::EQ,
                                  cast<lval::ConcreteInt>(R).getValue());
           
@@ -141,16 +141,16 @@
       case lval::DeclValKind:
       if (isa<lval::DeclVal>(R)) {        
         bool b = cast<lval::DeclVal>(*this) == cast<lval::DeclVal>(R);
-        return NonLVal::MakeIntTruthVal(ValMgr, b);
+        return NonLVal::MakeIntTruthVal(BasicVals, b);
       }
       
       break;
   }
   
-  return NonLVal::MakeIntTruthVal(ValMgr, false);
+  return NonLVal::MakeIntTruthVal(BasicVals, false);
 }
 
-NonLVal LVal::NE(ValueManager& ValMgr, const LVal& R) const {
+NonLVal LVal::NE(BasicValueFactory& BasicVals, const LVal& R) const {
   switch (getSubKind()) {
     default:
       assert(false && "NE not implemented for this LVal.");
@@ -161,12 +161,12 @@
         bool b = cast<lval::ConcreteInt>(this)->getValue() !=
                  cast<lval::ConcreteInt>(R).getValue();
         
-        return NonLVal::MakeIntTruthVal(ValMgr, b);
+        return NonLVal::MakeIntTruthVal(BasicVals, b);
       }
       else if (isa<lval::SymbolVal>(R)) {
         
         const SymIntConstraint& C =
-        ValMgr.getConstraint(cast<lval::SymbolVal>(R).getSymbol(),
+        BasicVals.getConstraint(cast<lval::SymbolVal>(R).getSymbol(),
                              BinaryOperator::NE,
                              cast<lval::ConcreteInt>(this)->getValue());
         
@@ -179,7 +179,7 @@
         if (isa<lval::ConcreteInt>(R)) {
           
           const SymIntConstraint& C =
-          ValMgr.getConstraint(cast<lval::SymbolVal>(this)->getSymbol(),
+          BasicVals.getConstraint(cast<lval::SymbolVal>(this)->getSymbol(),
                                BinaryOperator::NE,
                                cast<lval::ConcreteInt>(R).getValue());
           
@@ -194,31 +194,31 @@
       case lval::DeclValKind:
         if (isa<lval::DeclVal>(R)) {        
           bool b = cast<lval::DeclVal>(*this) == cast<lval::DeclVal>(R);
-          return NonLVal::MakeIntTruthVal(ValMgr, b);
+          return NonLVal::MakeIntTruthVal(BasicVals, b);
         }
       
         break;
   }
   
-  return NonLVal::MakeIntTruthVal(ValMgr, true);
+  return NonLVal::MakeIntTruthVal(BasicVals, true);
 }
 
 //===----------------------------------------------------------------------===//
 // Utility methods for constructing Non-LVals.
 //===----------------------------------------------------------------------===//
 
-NonLVal NonLVal::MakeVal(ValueManager& ValMgr, uint64_t X, QualType T) {  
-  return nonlval::ConcreteInt(ValMgr.getValue(X, T));
+NonLVal NonLVal::MakeVal(BasicValueFactory& BasicVals, uint64_t X, QualType T) {  
+  return nonlval::ConcreteInt(BasicVals.getValue(X, T));
 }
 
-NonLVal NonLVal::MakeVal(ValueManager& ValMgr, IntegerLiteral* I) {
+NonLVal NonLVal::MakeVal(BasicValueFactory& BasicVals, IntegerLiteral* I) {
 
-  return nonlval::ConcreteInt(ValMgr.getValue(APSInt(I->getValue(),
+  return nonlval::ConcreteInt(BasicVals.getValue(APSInt(I->getValue(),
                               I->getType()->isUnsignedIntegerType())));
 }
 
-NonLVal NonLVal::MakeIntTruthVal(ValueManager& ValMgr, bool b) {
-  return nonlval::ConcreteInt(ValMgr.getTruthValue(b));
+NonLVal NonLVal::MakeIntTruthVal(BasicValueFactory& BasicVals, bool b) {
+  return nonlval::ConcreteInt(BasicVals.getTruthValue(b));
 }
 
 RVal RVal::GetSymbolValue(SymbolManager& SymMgr, VarDecl* D) {

Removed: cfe/trunk/Analysis/ValueManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/ValueManager.cpp?rev=48024&view=auto

==============================================================================
--- cfe/trunk/Analysis/ValueManager.cpp (original)
+++ cfe/trunk/Analysis/ValueManager.cpp (removed)
@@ -1,166 +0,0 @@
-// ValueManager.h - Low-level value management for Value Tracking -*- C++ -*--==
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-//  This file defines ValueManager, a class that manages the lifetime of APSInt
-//  objects and symbolic constraints used by GRExprEngine and related classes.
-//
-//===----------------------------------------------------------------------===//
-
-#include "clang/Analysis/PathSensitive/ValueManager.h"
-
-using namespace clang;
-
-ValueManager::~ValueManager() {
-  // Note that the dstor for the contents of APSIntSet will never be called,
-  // so we iterate over the set and invoke the dstor for each APSInt.  This
-  // frees an aux. memory allocated to represent very large constants.
-  for (APSIntSetTy::iterator I=APSIntSet.begin(), E=APSIntSet.end(); I!=E; ++I)
-    I->getValue().~APSInt();
-}
-
-const llvm::APSInt& ValueManager::getValue(const llvm::APSInt& X) {
-  llvm::FoldingSetNodeID ID;
-  void* InsertPos;
-  typedef llvm::FoldingSetNodeWrapper<llvm::APSInt> FoldNodeTy;
-  
-  X.Profile(ID);
-  FoldNodeTy* P = APSIntSet.FindNodeOrInsertPos(ID, InsertPos);
-  
-  if (!P) {  
-    P = (FoldNodeTy*) BPAlloc.Allocate<FoldNodeTy>();
-    new (P) FoldNodeTy(X);
-    APSIntSet.InsertNode(P, InsertPos);
-  }
-  
-  return *P;
-}
-
-const llvm::APSInt& ValueManager::getValue(uint64_t X, unsigned BitWidth,
-                                           bool isUnsigned) {
-  llvm::APSInt V(BitWidth, isUnsigned);
-  V = X;  
-  return getValue(V);
-}
-
-const llvm::APSInt& ValueManager::getValue(uint64_t X, QualType T) {
-  
-  unsigned bits = Ctx.getTypeSize(T);
-  llvm::APSInt V(bits, T->isUnsignedIntegerType());
-  V = X;
-  return getValue(V);
-}
-
-const SymIntConstraint&
-ValueManager::getConstraint(SymbolID sym, BinaryOperator::Opcode Op,
-                            const llvm::APSInt& V) {
-  
-  llvm::FoldingSetNodeID ID;
-  SymIntConstraint::Profile(ID, sym, Op, V);
-  void* InsertPos;
-  
-  SymIntConstraint* C = SymIntCSet.FindNodeOrInsertPos(ID, InsertPos);
-  
-  if (!C) {
-    C = (SymIntConstraint*) BPAlloc.Allocate<SymIntConstraint>();
-    new (C) SymIntConstraint(sym, Op, V);
-    SymIntCSet.InsertNode(C, InsertPos);
-  }
-  
-  return *C;
-}
-
-const llvm::APSInt*
-ValueManager::EvaluateAPSInt(BinaryOperator::Opcode Op,
-                             const llvm::APSInt& V1, const llvm::APSInt& V2) {
-  
-  switch (Op) {
-    default:
-      assert (false && "Invalid Opcode.");
-      
-    case BinaryOperator::Mul:
-      return &getValue( V1 * V2 );
-      
-    case BinaryOperator::Div:
-      return &getValue( V1 / V2 );
-      
-    case BinaryOperator::Rem:
-      return &getValue( V1 % V2 );
-      
-    case BinaryOperator::Add:
-      return &getValue( V1 + V2 );
-      
-    case BinaryOperator::Sub:
-      return &getValue( V1 - V2 );
-      
-    case BinaryOperator::Shl: {
-
-      // FIXME: This logic should probably go higher up, where we can
-      // test these conditions symbolically.
-      
-      // FIXME: Expand these checks to include all undefined behavior.
-      
-      if (V2.isSigned() && V2.isNegative())
-        return NULL;
-      
-      uint64_t Amt = V2.getZExtValue();
-      
-      if (Amt > V1.getBitWidth())
-        return NULL;
-      
-      return &getValue( V1.operator<<( (unsigned) Amt ));
-    }
-      
-    case BinaryOperator::Shr: {
-      
-      // FIXME: This logic should probably go higher up, where we can
-      // test these conditions symbolically.
-      
-      // FIXME: Expand these checks to include all undefined behavior.
-      
-      if (V2.isSigned() && V2.isNegative())
-        return NULL;
-      
-      uint64_t Amt = V2.getZExtValue();
-      
-      if (Amt > V1.getBitWidth())
-        return NULL;
-      
-      return &getValue( V1.operator>>( (unsigned) Amt ));
-    }
-      
-    case BinaryOperator::LT:
-      return &getTruthValue( V1 < V2 );
-      
-    case BinaryOperator::GT:
-      return &getTruthValue( V1 > V2 );
-      
-    case BinaryOperator::LE:
-      return &getTruthValue( V1 <= V2 );
-      
-    case BinaryOperator::GE:
-      return &getTruthValue( V1 >= V2 );
-      
-    case BinaryOperator::EQ:
-      return &getTruthValue( V1 == V2 );
-      
-    case BinaryOperator::NE:
-      return &getTruthValue( V1 != V2 );
-      
-      // Note: LAnd, LOr, Comma are handled specially by higher-level logic.
-      
-    case BinaryOperator::And:
-      return &getValue( V1 & V2 );
-      
-    case BinaryOperator::Or:
-      return &getValue( V1 | V2 );
-      
-    case BinaryOperator::Xor:
-      return &getValue( V1 ^ V2 );
-  }
-}

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

==============================================================================
--- cfe/trunk/Analysis/ValueState.cpp (original)
+++ cfe/trunk/Analysis/ValueState.cpp Fri Mar  7 14:13:31 2008
@@ -245,7 +245,7 @@
           // are comparing states using pointer equality.  Perhaps there is
           // a better way, since APInts are fairly lightweight.
 
-          return nonlval::ConcreteInt(ValMgr.getValue(ED->getInitVal()));          
+          return nonlval::ConcreteInt(BasicVals.getValue(ED->getInitVal()));          
         }
         else if (FunctionDecl* FD = dyn_cast<FunctionDecl>(D))
           return lval::FuncVal(FD);
@@ -258,11 +258,11 @@
         
       case Stmt::CharacterLiteralClass: {
         CharacterLiteral* C = cast<CharacterLiteral>(E);
-        return NonLVal::MakeVal(ValMgr, C->getValue(), C->getType());
+        return NonLVal::MakeVal(BasicVals, C->getValue(), C->getType());
       }
         
       case Stmt::IntegerLiteralClass: {
-        return NonLVal::MakeVal(ValMgr, cast<IntegerLiteral>(E));
+        return NonLVal::MakeVal(BasicVals, cast<IntegerLiteral>(E));
       }
 
         // Casts where the source and target type are the same
@@ -339,11 +339,11 @@
   switch (E->getStmtClass()) {
     case Stmt::CharacterLiteralClass: {
       CharacterLiteral* C = cast<CharacterLiteral>(E);
-      return NonLVal::MakeVal(ValMgr, C->getValue(), C->getType());
+      return NonLVal::MakeVal(BasicVals, C->getValue(), C->getType());
     }
       
     case Stmt::IntegerLiteralClass: {
-      return NonLVal::MakeVal(ValMgr, cast<IntegerLiteral>(E));
+      return NonLVal::MakeVal(BasicVals, cast<IntegerLiteral>(E));
     }
       
     default: {

Modified: cfe/trunk/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=48025&r1=48024&r2=48025&view=diff

==============================================================================
--- cfe/trunk/clang.xcodeproj/project.pbxproj (original)
+++ cfe/trunk/clang.xcodeproj/project.pbxproj Fri Mar  7 14:13:31 2008
@@ -26,6 +26,8 @@
 		35BB2D7D0D19951A00944DB5 /* TranslationUnit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 35BB2D7C0D19951A00944DB5 /* TranslationUnit.cpp */; };
 		35BB2D7F0D19954000944DB5 /* ASTConsumer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 35BB2D7E0D19954000944DB5 /* ASTConsumer.cpp */; };
 		35CFFE000CA1CBCB00E6F2BE /* StmtViz.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 35CFFDFF0CA1CBCB00E6F2BE /* StmtViz.cpp */; };
+		35D55B270D81D8C60092E734 /* BasicValueFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 35D55B240D81D8C60092E734 /* BasicValueFactory.cpp */; };
+		35D55B280D81D8C60092E734 /* CFRefCount.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 35D55B250D81D8C60092E734 /* CFRefCount.cpp */; };
 		84AF36A10CB17A3B00C820A5 /* DeclObjC.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84AF36A00CB17A3B00C820A5 /* DeclObjC.h */; };
 		84D9A8880C1A57E100AC7ABC /* AttributeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84D9A8870C1A57E100AC7ABC /* AttributeList.cpp */; };
 		84D9A88C0C1A581300AC7ABC /* AttributeList.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D9A88B0C1A581300AC7ABC /* AttributeList.h */; };
@@ -71,7 +73,6 @@
 		DE4121360D7F1C1C0080F80A /* ExplodedGraph.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE4121280D7F1C1C0080F80A /* ExplodedGraph.cpp */; };
 		DE4121370D7F1C1C0080F80A /* UninitializedValues.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE4121290D7F1C1C0080F80A /* UninitializedValues.cpp */; };
 		DE4121380D7F1C1C0080F80A /* GRCoreEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE41212A0D7F1C1C0080F80A /* GRCoreEngine.cpp */; };
-		DE4121390D7F1C1C0080F80A /* ValueManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE41212B0D7F1C1C0080F80A /* ValueManager.cpp */; };
 		DE41213A0D7F1C1C0080F80A /* LiveVariables.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE41212D0D7F1C1C0080F80A /* LiveVariables.cpp */; };
 		DE41213B0D7F1C1C0080F80A /* RValues.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE41212E0D7F1C1C0080F80A /* RValues.cpp */; };
 		DE41213C0D7F1C1C0080F80A /* GRSimpleVals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE41212F0D7F1C1C0080F80A /* GRSimpleVals.cpp */; };
@@ -268,6 +269,10 @@
 		35CFFE010CA1CBDD00E6F2BE /* StmtGraphTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StmtGraphTraits.h; path = clang/AST/StmtGraphTraits.h; sourceTree = "<group>"; };
 		35D1DDD10CA9C6D50096E967 /* DataflowSolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DataflowSolver.h; path = clang/Analysis/FlowSensitive/DataflowSolver.h; sourceTree = "<group>"; };
 		35D1DDD20CA9C6D50096E967 /* DataflowValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DataflowValues.h; path = clang/Analysis/FlowSensitive/DataflowValues.h; sourceTree = "<group>"; };
+		35D55B240D81D8C60092E734 /* BasicValueFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BasicValueFactory.cpp; path = Analysis/BasicValueFactory.cpp; sourceTree = "<group>"; };
+		35D55B250D81D8C60092E734 /* CFRefCount.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CFRefCount.cpp; path = Analysis/CFRefCount.cpp; sourceTree = "<group>"; };
+		35D55B260D81D8C60092E734 /* CFRefCount.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CFRefCount.h; path = Analysis/CFRefCount.h; sourceTree = "<group>"; };
+		35D55B290D81D8E50092E734 /* BasicValueFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BasicValueFactory.h; path = clang/Analysis/PathSensitive/BasicValueFactory.h; sourceTree = "<group>"; };
 		35F9B1530D1C6ADF00DDFDAE /* ExprDeclBitVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ExprDeclBitVector.h; path = clang/Analysis/Support/ExprDeclBitVector.h; sourceTree = "<group>"; };
 		35F9B1550D1C6B2E00DDFDAE /* LiveVariables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LiveVariables.h; path = clang/Analysis/Analyses/LiveVariables.h; sourceTree = "<group>"; };
 		35F9B1560D1C6B2E00DDFDAE /* UninitializedValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UninitializedValues.h; path = clang/Analysis/Analyses/UninitializedValues.h; sourceTree = "<group>"; };
@@ -312,7 +317,6 @@
 		DE39857A0CB8ADCB00223765 /* ASTConsumers.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = ASTConsumers.cpp; path = Driver/ASTConsumers.cpp; sourceTree = "<group>"; };
 		DE3986EF0CB8D4B300223765 /* IdentifierTable.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IdentifierTable.h; sourceTree = "<group>"; };
 		DE3986F30CB8D50C00223765 /* IdentifierTable.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IdentifierTable.cpp; sourceTree = "<group>"; };
-		DE41211A0D7F1BBE0080F80A /* ValueManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ValueManager.h; path = clang/Analysis/PathSensitive/ValueManager.h; sourceTree = "<group>"; };
 		DE41211B0D7F1BBE0080F80A /* RValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RValues.h; path = clang/Analysis/PathSensitive/RValues.h; sourceTree = "<group>"; };
 		DE41211C0D7F1BBE0080F80A /* ValueState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ValueState.h; path = clang/Analysis/PathSensitive/ValueState.h; sourceTree = "<group>"; };
 		DE41211D0D7F1BBE0080F80A /* GRWorkList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GRWorkList.h; path = clang/Analysis/PathSensitive/GRWorkList.h; sourceTree = "<group>"; };
@@ -328,7 +332,6 @@
 		DE4121280D7F1C1C0080F80A /* ExplodedGraph.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ExplodedGraph.cpp; path = Analysis/ExplodedGraph.cpp; sourceTree = "<group>"; };
 		DE4121290D7F1C1C0080F80A /* UninitializedValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UninitializedValues.cpp; path = Analysis/UninitializedValues.cpp; sourceTree = "<group>"; };
 		DE41212A0D7F1C1C0080F80A /* GRCoreEngine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GRCoreEngine.cpp; path = Analysis/GRCoreEngine.cpp; sourceTree = "<group>"; };
-		DE41212B0D7F1C1C0080F80A /* ValueManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ValueManager.cpp; path = Analysis/ValueManager.cpp; sourceTree = "<group>"; };
 		DE41212C0D7F1C1C0080F80A /* GRSimpleVals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GRSimpleVals.h; path = Analysis/GRSimpleVals.h; sourceTree = "<group>"; };
 		DE41212D0D7F1C1C0080F80A /* LiveVariables.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LiveVariables.cpp; path = Analysis/LiveVariables.cpp; sourceTree = "<group>"; };
 		DE41212E0D7F1C1C0080F80A /* RValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RValues.cpp; path = Analysis/RValues.cpp; sourceTree = "<group>"; };
@@ -495,6 +498,9 @@
 		356EF9B30C8F7DCA006650F5 /* Analysis */ = {
 			isa = PBXGroup;
 			children = (
+				35D55B240D81D8C60092E734 /* BasicValueFactory.cpp */,
+				35D55B250D81D8C60092E734 /* CFRefCount.cpp */,
+				35D55B260D81D8C60092E734 /* CFRefCount.h */,
 				356EF9B40C8F7DDF006650F5 /* LiveVariables.cpp */,
 				DE4121250D7F1C1C0080F80A /* ValueState.cpp */,
 				DE4121260D7F1C1C0080F80A /* DeadStores.cpp */,
@@ -502,7 +508,6 @@
 				DE4121280D7F1C1C0080F80A /* ExplodedGraph.cpp */,
 				DE4121290D7F1C1C0080F80A /* UninitializedValues.cpp */,
 				DE41212A0D7F1C1C0080F80A /* GRCoreEngine.cpp */,
-				DE41212B0D7F1C1C0080F80A /* ValueManager.cpp */,
 				DE41212C0D7F1C1C0080F80A /* GRSimpleVals.h */,
 				DE41212D0D7F1C1C0080F80A /* LiveVariables.cpp */,
 				DE41212E0D7F1C1C0080F80A /* RValues.cpp */,
@@ -584,7 +589,7 @@
 		DE4121130D7F1B980080F80A /* PathSensitive */ = {
 			isa = PBXGroup;
 			children = (
-				DE41211A0D7F1BBE0080F80A /* ValueManager.h */,
+				35D55B290D81D8E50092E734 /* BasicValueFactory.h */,
 				DE41211B0D7F1BBE0080F80A /* RValues.h */,
 				DE41211C0D7F1BBE0080F80A /* ValueState.h */,
 				DE41211D0D7F1BBE0080F80A /* GRWorkList.h */,
@@ -970,13 +975,14 @@
 				DE4121360D7F1C1C0080F80A /* ExplodedGraph.cpp in Sources */,
 				DE4121370D7F1C1C0080F80A /* UninitializedValues.cpp in Sources */,
 				DE4121380D7F1C1C0080F80A /* GRCoreEngine.cpp in Sources */,
-				DE4121390D7F1C1C0080F80A /* ValueManager.cpp in Sources */,
 				DE41213A0D7F1C1C0080F80A /* LiveVariables.cpp in Sources */,
 				DE41213B0D7F1C1C0080F80A /* RValues.cpp in Sources */,
 				DE41213C0D7F1C1C0080F80A /* GRSimpleVals.cpp in Sources */,
 				DE41213D0D7F1C1C0080F80A /* GRBlockCounter.cpp in Sources */,
 				DE41213E0D7F1C1C0080F80A /* GRExprEngine.cpp in Sources */,
 				DE41213F0D7F1C1C0080F80A /* ProgramPoint.cpp in Sources */,
+				35D55B270D81D8C60092E734 /* BasicValueFactory.cpp in Sources */,
+				35D55B280D81D8C60092E734 /* CFRefCount.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Copied: cfe/trunk/include/clang/Analysis/PathSensitive/BasicValueFactory.h (from r48016, cfe/trunk/include/clang/Analysis/PathSensitive/ValueManager.h)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/BasicValueFactory.h?p2=cfe/trunk/include/clang/Analysis/PathSensitive/BasicValueFactory.h&p1=cfe/trunk/include/clang/Analysis/PathSensitive/ValueManager.h&r1=48016&r2=48025&rev=48025&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/ValueManager.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/BasicValueFactory.h Fri Mar  7 14:13:31 2008
@@ -1,4 +1,4 @@
-// ValueManager.h - Low-level value management for Value Tracking -*- C++ -*--==
+//=== BasicValueFactory.h - Basic values for Path Sens analysis --*- C++ -*---//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,13 +7,14 @@
 //
 //===----------------------------------------------------------------------===//
 //
-//  This file defines ValueManager, a class that manages the lifetime of APSInt
-//  objects and symbolic constraints used by GRExprEngine and related classes.
+//  This file defines BasicValueFactory, a class that manages the lifetime
+//  of APSInt objects and symbolic constraints used by GRExprEngine 
+//  and related classes.
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_ANALYSIS_VALUEMANAGER_H
-#define LLVM_CLANG_ANALYSIS_VALUEMANAGER_H
+#ifndef LLVM_CLANG_ANALYSIS_BASICVALUEFACTORY_H
+#define LLVM_CLANG_ANALYSIS_BASICVALUEFACTORY_H
 
 #include "clang/Analysis/PathSensitive/SymbolManager.h"
 #include "clang/AST/ASTContext.h"
@@ -26,7 +27,7 @@
 
 namespace clang {
   
-class ValueManager {
+class BasicValueFactory {
   typedef llvm::FoldingSet<llvm::FoldingSetNodeWrapper<llvm::APSInt> >
           APSIntSetTy;
 
@@ -40,10 +41,10 @@
   SymIntCSetTy  SymIntCSet;
 
 public:
-  ValueManager(ASTContext& ctx, llvm::BumpPtrAllocator& Alloc) 
+  BasicValueFactory(ASTContext& ctx, llvm::BumpPtrAllocator& Alloc) 
   : Ctx(ctx), BPAlloc(Alloc) {}
 
-  ~ValueManager();
+  ~BasicValueFactory();
 
   ASTContext& getContext() const { return Ctx; }  
 

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

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/GRExprEngine.h Fri Mar  7 14:13:31 2008
@@ -49,7 +49,7 @@
   ValueStateManager StateMgr;
   
   /// ValueMgr - Object that manages the data for all created RVals.
-  ValueManager& ValMgr;
+  BasicValueFactory& BasicVals;
   
   /// TF - Object that represents a bundle of transfer functions
   ///  for manipulating and creating RVals.
@@ -127,7 +127,7 @@
   G(g), Liveness(G.getCFG(), G.getFunctionDecl()),
   Builder(NULL),
   StateMgr(G.getContext(), G.getAllocator()),
-  ValMgr(StateMgr.getValueManager()),
+  BasicVals(StateMgr.getBasicValueFactory()),
   TF(NULL), // FIXME.
   SymMgr(StateMgr.getSymbolManager()),
   StmtEntryNode(NULL), CurrentStmt(NULL) {
@@ -310,7 +310,7 @@
   }
   
   inline NonLVal MakeConstantVal(uint64_t X, Expr* Ex) {
-    return NonLVal::MakeVal(ValMgr, X, Ex->getType());
+    return NonLVal::MakeVal(BasicVals, X, Ex->getType());
   }
   
   /// Assume - Create new state by assuming that a given expression
@@ -399,25 +399,25 @@
       return X;
     
     if (isa<LVal>(X))
-      return TF->EvalCast(ValMgr, cast<LVal>(X), CastT);
+      return TF->EvalCast(BasicVals, cast<LVal>(X), CastT);
     else
-      return TF->EvalCast(ValMgr, cast<NonLVal>(X), CastT);
+      return TF->EvalCast(BasicVals, cast<NonLVal>(X), CastT);
   }
   
   RVal EvalMinus(UnaryOperator* U, RVal X) {
-    return X.isValid() ? TF->EvalMinus(ValMgr, U, cast<NonLVal>(X)) : X;
+    return X.isValid() ? TF->EvalMinus(BasicVals, U, cast<NonLVal>(X)) : X;
   }
   
   RVal EvalComplement(RVal X) {
-    return X.isValid() ? TF->EvalComplement(ValMgr, cast<NonLVal>(X)) : X;
+    return X.isValid() ? TF->EvalComplement(BasicVals, cast<NonLVal>(X)) : X;
   }
 
   RVal EvalBinOp(BinaryOperator::Opcode Op, NonLVal L, RVal R) {
-    return R.isValid() ? TF->EvalBinOp(ValMgr, Op, L, cast<NonLVal>(R)) : R;
+    return R.isValid() ? TF->EvalBinOp(BasicVals, Op, L, cast<NonLVal>(R)) : R;
   }
   
   RVal EvalBinOp(BinaryOperator::Opcode Op, NonLVal L, NonLVal R) {
-    return R.isValid() ? TF->EvalBinOp(ValMgr, Op, L, R) : R;
+    return R.isValid() ? TF->EvalBinOp(BasicVals, Op, L, R) : R;
   }
   
   RVal EvalBinOp(BinaryOperator::Opcode Op, RVal L, RVal R) {
@@ -430,17 +430,17 @@
         
     if (isa<LVal>(L)) {
       if (isa<LVal>(R))
-        return TF->EvalBinOp(ValMgr, Op, cast<LVal>(L), cast<LVal>(R));
+        return TF->EvalBinOp(BasicVals, Op, cast<LVal>(L), cast<LVal>(R));
       else
-        return TF->EvalBinOp(ValMgr, Op, cast<LVal>(L), cast<NonLVal>(R));
+        return TF->EvalBinOp(BasicVals, Op, cast<LVal>(L), cast<NonLVal>(R));
     }
     
-    return TF->EvalBinOp(ValMgr, Op, cast<NonLVal>(L), cast<NonLVal>(R));
+    return TF->EvalBinOp(BasicVals, Op, cast<NonLVal>(L), cast<NonLVal>(R));
   }
   
   void EvalCall(NodeSet& Dst, CallExpr* CE, LVal L, NodeTy* Pred) {
     assert (Builder && "GRStmtNodeBuilder must be defined.");    
-    return TF->EvalCall(Dst, StateMgr, *Builder, ValMgr, CE, L, Pred);
+    return TF->EvalCall(Dst, StateMgr, *Builder, BasicVals, CE, L, Pred);
   }
   
   ValueState* MarkBranch(ValueState* St, Stmt* Terminator, bool branchTaken);

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

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/GRTransferFuncs.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/GRTransferFuncs.h Fri Mar  7 14:13:31 2008
@@ -30,26 +30,26 @@
   
   // Casts.
   
-  virtual RVal EvalCast(ValueManager& ValMgr, NonLVal V, QualType CastT) =0;
-  virtual RVal EvalCast(ValueManager& ValMgr, LVal V, QualType CastT) = 0;
+  virtual RVal EvalCast(BasicValueFactory& BasicVals, NonLVal V, QualType CastT) =0;
+  virtual RVal EvalCast(BasicValueFactory& BasicVals, LVal V, QualType CastT) = 0;
 
   // Unary Operators.
   
-  virtual RVal EvalMinus(ValueManager& ValMgr, UnaryOperator* U, NonLVal X) = 0;
+  virtual RVal EvalMinus(BasicValueFactory& BasicVals, UnaryOperator* U, NonLVal X) = 0;
 
-  virtual RVal EvalComplement(ValueManager& ValMgr, NonLVal X) = 0;
+  virtual RVal EvalComplement(BasicValueFactory& BasicVals, NonLVal X) = 0;
 
   // Binary Operators.
   
-  virtual RVal EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
+  virtual RVal EvalBinOp(BasicValueFactory& BasicVals, BinaryOperator::Opcode Op,
                          NonLVal L, NonLVal R) = 0;
   
-  virtual RVal EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
+  virtual RVal EvalBinOp(BasicValueFactory& BasicVals, BinaryOperator::Opcode Op,
                          LVal L, LVal R) = 0;
   
   // Pointer arithmetic.
   
-  virtual RVal EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
+  virtual RVal EvalBinOp(BasicValueFactory& BasicVals, BinaryOperator::Opcode Op,
                          LVal L, NonLVal R) = 0;
   
   // Calls.
@@ -57,7 +57,7 @@
   virtual void EvalCall(ExplodedNodeSet<ValueState>& Dst,
                         ValueStateManager& StateMgr,
                         GRStmtNodeBuilder<ValueState>& Builder,
-                        ValueManager& ValMgr, CallExpr* CE, LVal L,
+                        BasicValueFactory& BasicVals, CallExpr* CE, LVal L,
                         ExplodedNode<ValueState>* Pred) = 0;
 };
   

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

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/RValues.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/RValues.h Fri Mar  7 14:13:31 2008
@@ -15,7 +15,7 @@
 #ifndef LLVM_CLANG_ANALYSIS_RVALUE_H
 #define LLVM_CLANG_ANALYSIS_RVALUE_H
 
-#include "clang/Analysis/PathSensitive/ValueManager.h"
+#include "clang/Analysis/PathSensitive/BasicValueFactory.h"
 #include "llvm/Support/Casting.h"
   
 //==------------------------------------------------------------------------==//
@@ -123,11 +123,11 @@
   void print(std::ostream& Out) const;
   
   // Utility methods to create NonLVals.
-  static NonLVal MakeVal(ValueManager& ValMgr, uint64_t X, QualType T);
+  static NonLVal MakeVal(BasicValueFactory& BasicVals, uint64_t X, QualType T);
   
-  static NonLVal MakeVal(ValueManager& ValMgr, IntegerLiteral* I);
+  static NonLVal MakeVal(BasicValueFactory& BasicVals, IntegerLiteral* I);
   
-  static NonLVal MakeIntTruthVal(ValueManager& ValMgr, bool b);
+  static NonLVal MakeIntTruthVal(BasicValueFactory& BasicVals, bool b);
     
   // Implement isa<T> support.
   static inline bool classof(const RVal* V) {
@@ -141,8 +141,8 @@
     : RVal(const_cast<void*>(D), true, SubKind) {}
   
   // Equality operators.
-  NonLVal EQ(ValueManager& ValMgr, const LVal& R) const;
-  NonLVal NE(ValueManager& ValMgr, const LVal& R) const;
+  NonLVal EQ(BasicValueFactory& BasicVals, const LVal& R) const;
+  NonLVal NE(BasicValueFactory& BasicVals, const LVal& R) const;
   
 public:
   void print(std::ostream& Out) const;
@@ -210,12 +210,12 @@
   }
   
   // Transfer functions for binary/unary operations on ConcreteInts.
-  RVal EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
+  RVal EvalBinOp(BasicValueFactory& BasicVals, BinaryOperator::Opcode Op,
                  const ConcreteInt& R) const;
   
-  ConcreteInt EvalComplement(ValueManager& ValMgr) const;
+  ConcreteInt EvalComplement(BasicValueFactory& BasicVals) const;
   
-  ConcreteInt EvalMinus(ValueManager& ValMgr, UnaryOperator* U) const;
+  ConcreteInt EvalMinus(BasicValueFactory& BasicVals, UnaryOperator* U) const;
   
   // Implement isa<T> support.
   static inline bool classof(const RVal* V) {
@@ -340,7 +340,7 @@
   }
 
   // Transfer functions for binary/unary operations on ConcreteInts.
-  RVal EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
+  RVal EvalBinOp(BasicValueFactory& BasicVals, BinaryOperator::Opcode Op,
                  const ConcreteInt& R) const;
       
   // Implement isa<T> support.

Removed: cfe/trunk/include/clang/Analysis/PathSensitive/ValueManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/ValueManager.h?rev=48024&view=auto

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/ValueManager.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/ValueManager.h (removed)
@@ -1,72 +0,0 @@
-// ValueManager.h - Low-level value management for Value Tracking -*- C++ -*--==
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-//  This file defines ValueManager, a class that manages the lifetime of APSInt
-//  objects and symbolic constraints used by GRExprEngine and related classes.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CLANG_ANALYSIS_VALUEMANAGER_H
-#define LLVM_CLANG_ANALYSIS_VALUEMANAGER_H
-
-#include "clang/Analysis/PathSensitive/SymbolManager.h"
-#include "clang/AST/ASTContext.h"
-#include "llvm/ADT/FoldingSet.h"
-#include "llvm/ADT/APSInt.h"
-
-namespace llvm {
-  class BumpPtrAllocator;
-}
-
-namespace clang {
-  
-class ValueManager {
-  typedef llvm::FoldingSet<llvm::FoldingSetNodeWrapper<llvm::APSInt> >
-          APSIntSetTy;
-
-  typedef llvm::FoldingSet<SymIntConstraint>
-          SymIntCSetTy;
-
-  ASTContext& Ctx;
-  llvm::BumpPtrAllocator& BPAlloc;
-
-  APSIntSetTy   APSIntSet;
-  SymIntCSetTy  SymIntCSet;
-
-public:
-  ValueManager(ASTContext& ctx, llvm::BumpPtrAllocator& Alloc) 
-  : Ctx(ctx), BPAlloc(Alloc) {}
-
-  ~ValueManager();
-
-  ASTContext& getContext() const { return Ctx; }  
-
-  const llvm::APSInt& getValue(const llvm::APSInt& X);
-  const llvm::APSInt& getValue(uint64_t X, unsigned BitWidth, bool isUnsigned);
-  const llvm::APSInt& getValue(uint64_t X, QualType T);
-
-  inline const llvm::APSInt& getZeroWithPtrWidth() {
-    return getValue(0, Ctx.getTypeSize(Ctx.VoidPtrTy), true);
-  }
-
-  inline const llvm::APSInt& getTruthValue(bool b) {
-    return getValue(b ? 1 : 0, Ctx.getTypeSize(Ctx.IntTy), false);
-  }
-
-  const SymIntConstraint& getConstraint(SymbolID sym, BinaryOperator::Opcode Op,
-                                        const llvm::APSInt& V);
-
-  const llvm::APSInt* EvaluateAPSInt(BinaryOperator::Opcode Op,
-                                     const llvm::APSInt& V1,
-                                     const llvm::APSInt& V2);
-};
-
-} // end clang namespace
-
-#endif

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

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/ValueState.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/ValueState.h Fri Mar  7 14:13:31 2008
@@ -169,7 +169,7 @@
   llvm::FoldingSet<ValueState> StateSet;
 
   /// ValueMgr - Object that manages the data for all created RVals.
-  ValueManager ValMgr;
+  BasicValueFactory BasicVals;
 
   /// SymMgr - Object that manages the symbol information.
   SymbolManager SymMgr;
@@ -205,12 +205,12 @@
       VBFactory(alloc),
       CNEFactory(alloc),
       CEFactory(alloc),
-      ValMgr(Ctx, alloc),
+      BasicVals(Ctx, alloc),
       Alloc(alloc) {}
   
   ValueState* getInitialState();
         
-  ValueManager& getValueManager() { return ValMgr; }
+  BasicValueFactory& getBasicValueFactory() { return BasicVals; }
   SymbolManager& getSymbolManager() { return SymMgr; }
   
   ValueState* RemoveDeadBindings(ValueState* St, Stmt* Loc, 





More information about the cfe-commits mailing list