Renamed ValueManager to BasicValueFactory.
llvm-svn: 48025
This commit is contained in:
parent
39a3221e27
commit
910e9de131
|
@ -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
|
// The LLVM Compiler Infrastructure
|
||||||
//
|
//
|
||||||
|
@ -7,16 +7,17 @@
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
//
|
//
|
||||||
// This file defines ValueManager, a class that manages the lifetime of APSInt
|
// This file defines BasicValueFactory, a class that manages the lifetime
|
||||||
// objects and symbolic constraints used by GRExprEngine and related classes.
|
// 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;
|
using namespace clang;
|
||||||
|
|
||||||
ValueManager::~ValueManager() {
|
BasicValueFactory::~BasicValueFactory() {
|
||||||
// Note that the dstor for the contents of APSIntSet will never be called,
|
// 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
|
// so we iterate over the set and invoke the dstor for each APSInt. This
|
||||||
// frees an aux. memory allocated to represent very large constants.
|
// frees an aux. memory allocated to represent very large constants.
|
||||||
|
@ -24,7 +25,7 @@ ValueManager::~ValueManager() {
|
||||||
I->getValue().~APSInt();
|
I->getValue().~APSInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
const llvm::APSInt& ValueManager::getValue(const llvm::APSInt& X) {
|
const llvm::APSInt& BasicValueFactory::getValue(const llvm::APSInt& X) {
|
||||||
llvm::FoldingSetNodeID ID;
|
llvm::FoldingSetNodeID ID;
|
||||||
void* InsertPos;
|
void* InsertPos;
|
||||||
typedef llvm::FoldingSetNodeWrapper<llvm::APSInt> FoldNodeTy;
|
typedef llvm::FoldingSetNodeWrapper<llvm::APSInt> FoldNodeTy;
|
||||||
|
@ -41,14 +42,14 @@ const llvm::APSInt& ValueManager::getValue(const llvm::APSInt& X) {
|
||||||
return *P;
|
return *P;
|
||||||
}
|
}
|
||||||
|
|
||||||
const llvm::APSInt& ValueManager::getValue(uint64_t X, unsigned BitWidth,
|
const llvm::APSInt& BasicValueFactory::getValue(uint64_t X, unsigned BitWidth,
|
||||||
bool isUnsigned) {
|
bool isUnsigned) {
|
||||||
llvm::APSInt V(BitWidth, isUnsigned);
|
llvm::APSInt V(BitWidth, isUnsigned);
|
||||||
V = X;
|
V = X;
|
||||||
return getValue(V);
|
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);
|
unsigned bits = Ctx.getTypeSize(T);
|
||||||
llvm::APSInt V(bits, T->isUnsignedIntegerType());
|
llvm::APSInt V(bits, T->isUnsignedIntegerType());
|
||||||
|
@ -57,7 +58,7 @@ const llvm::APSInt& ValueManager::getValue(uint64_t X, QualType T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const SymIntConstraint&
|
const SymIntConstraint&
|
||||||
ValueManager::getConstraint(SymbolID sym, BinaryOperator::Opcode Op,
|
BasicValueFactory::getConstraint(SymbolID sym, BinaryOperator::Opcode Op,
|
||||||
const llvm::APSInt& V) {
|
const llvm::APSInt& V) {
|
||||||
|
|
||||||
llvm::FoldingSetNodeID ID;
|
llvm::FoldingSetNodeID ID;
|
||||||
|
@ -76,7 +77,7 @@ ValueManager::getConstraint(SymbolID sym, BinaryOperator::Opcode Op,
|
||||||
}
|
}
|
||||||
|
|
||||||
const llvm::APSInt*
|
const llvm::APSInt*
|
||||||
ValueManager::EvaluateAPSInt(BinaryOperator::Opcode Op,
|
BasicValueFactory::EvaluateAPSInt(BinaryOperator::Opcode Op,
|
||||||
const llvm::APSInt& V1, const llvm::APSInt& V2) {
|
const llvm::APSInt& V1, const llvm::APSInt& V2) {
|
||||||
|
|
||||||
switch (Op) {
|
switch (Op) {
|
|
@ -44,7 +44,7 @@ void CheckCFRefCount(CFG& cfg, FunctionDecl& FD, ASTContext& Ctx,
|
||||||
void CFRefCount::EvalCall(ExplodedNodeSet<ValueState>& Dst,
|
void CFRefCount::EvalCall(ExplodedNodeSet<ValueState>& Dst,
|
||||||
ValueStateManager& StateMgr,
|
ValueStateManager& StateMgr,
|
||||||
GRStmtNodeBuilder<ValueState>& Builder,
|
GRStmtNodeBuilder<ValueState>& Builder,
|
||||||
ValueManager& ValMgr,
|
BasicValueFactory& BasicVals,
|
||||||
CallExpr* CE, LVal L,
|
CallExpr* CE, LVal L,
|
||||||
ExplodedNode<ValueState>* Pred) {
|
ExplodedNode<ValueState>* Pred) {
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ public:
|
||||||
virtual void EvalCall(ExplodedNodeSet<ValueState>& Dst,
|
virtual void EvalCall(ExplodedNodeSet<ValueState>& Dst,
|
||||||
ValueStateManager& StateMgr,
|
ValueStateManager& StateMgr,
|
||||||
GRStmtNodeBuilder<ValueState>& Builder,
|
GRStmtNodeBuilder<ValueState>& Builder,
|
||||||
ValueManager& ValMgr,
|
BasicValueFactory& BasicVals,
|
||||||
CallExpr* CE, LVal L,
|
CallExpr* CE, LVal L,
|
||||||
ExplodedNode<ValueState>* Pred);
|
ExplodedNode<ValueState>* Pred);
|
||||||
};
|
};
|
||||||
|
|
|
@ -308,7 +308,7 @@ void GRExprEngine::ProcessSwitch(SwitchNodeBuilder& builder) {
|
||||||
// This should be easy once we have "ranges" for NonLVals.
|
// This should be easy once we have "ranges" for NonLVals.
|
||||||
|
|
||||||
do {
|
do {
|
||||||
nonlval::ConcreteInt CaseVal(ValMgr.getValue(V1));
|
nonlval::ConcreteInt CaseVal(BasicVals.getValue(V1));
|
||||||
|
|
||||||
RVal Res = EvalBinOp(BinaryOperator::EQ, CondV, CaseVal);
|
RVal Res = EvalBinOp(BinaryOperator::EQ, CondV, CaseVal);
|
||||||
|
|
||||||
|
@ -657,12 +657,12 @@ void GRExprEngine::VisitDeclStmt(DeclStmt* DS, GRExprEngine::NodeTy* Pred,
|
||||||
if (T->isPointerType()) {
|
if (T->isPointerType()) {
|
||||||
|
|
||||||
St = SetRVal(St, lval::DeclVal(VD),
|
St = SetRVal(St, lval::DeclVal(VD),
|
||||||
lval::ConcreteInt(ValMgr.getValue(0, T)));
|
lval::ConcreteInt(BasicVals.getValue(0, T)));
|
||||||
}
|
}
|
||||||
else if (T->isIntegerType()) {
|
else if (T->isIntegerType()) {
|
||||||
|
|
||||||
St = SetRVal(St, lval::DeclVal(VD),
|
St = SetRVal(St, lval::DeclVal(VD),
|
||||||
nonlval::ConcreteInt(ValMgr.getValue(0, T)));
|
nonlval::ConcreteInt(BasicVals.getValue(0, T)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -727,7 +727,7 @@ void GRExprEngine::VisitSizeOfAlignOfTypeExpr(SizeOfAlignOfTypeExpr* Ex,
|
||||||
|
|
||||||
Nodify(Dst, Ex, Pred,
|
Nodify(Dst, Ex, Pred,
|
||||||
SetRVal(Pred->getState(), Ex,
|
SetRVal(Pred->getState(), Ex,
|
||||||
NonLVal::MakeVal(ValMgr, size, Ex->getType())));
|
NonLVal::MakeVal(BasicVals, size, Ex->getType())));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -917,13 +917,13 @@ void GRExprEngine::VisitUnaryOperator(UnaryOperator* U, NodeTy* Pred,
|
||||||
// transfer functions as "0 == E".
|
// transfer functions as "0 == E".
|
||||||
|
|
||||||
if (isa<LVal>(SubV)) {
|
if (isa<LVal>(SubV)) {
|
||||||
lval::ConcreteInt V(ValMgr.getZeroWithPtrWidth());
|
lval::ConcreteInt V(BasicVals.getZeroWithPtrWidth());
|
||||||
RVal Result = EvalBinOp(BinaryOperator::EQ, cast<LVal>(SubV), V);
|
RVal Result = EvalBinOp(BinaryOperator::EQ, cast<LVal>(SubV), V);
|
||||||
St = SetRVal(St, U, Result);
|
St = SetRVal(St, U, Result);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Expr* Ex = U->getSubExpr();
|
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);
|
RVal Result = EvalBinOp(BinaryOperator::EQ, cast<NonLVal>(SubV), V);
|
||||||
St = SetRVal(St, U, Result);
|
St = SetRVal(St, U, Result);
|
||||||
}
|
}
|
||||||
|
@ -955,7 +955,7 @@ void GRExprEngine::VisitSizeOfExpr(UnaryOperator* U, NodeTy* Pred,
|
||||||
|
|
||||||
uint64_t size = getContext().getTypeSize(T) / 8;
|
uint64_t size = getContext().getTypeSize(T) / 8;
|
||||||
ValueState* St = Pred->getState();
|
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);
|
Nodify(Dst, U, Pred, St);
|
||||||
}
|
}
|
||||||
|
@ -1433,10 +1433,10 @@ ValueState* GRExprEngine::Assume(ValueState* St, LVal Cond,
|
||||||
case lval::SymbolValKind:
|
case lval::SymbolValKind:
|
||||||
if (Assumption)
|
if (Assumption)
|
||||||
return AssumeSymNE(St, cast<lval::SymbolVal>(Cond).getSymbol(),
|
return AssumeSymNE(St, cast<lval::SymbolVal>(Cond).getSymbol(),
|
||||||
ValMgr.getZeroWithPtrWidth(), isFeasible);
|
BasicVals.getZeroWithPtrWidth(), isFeasible);
|
||||||
else
|
else
|
||||||
return AssumeSymEQ(St, cast<lval::SymbolVal>(Cond).getSymbol(),
|
return AssumeSymEQ(St, cast<lval::SymbolVal>(Cond).getSymbol(),
|
||||||
ValMgr.getZeroWithPtrWidth(), isFeasible);
|
BasicVals.getZeroWithPtrWidth(), isFeasible);
|
||||||
|
|
||||||
|
|
||||||
case lval::DeclValKind:
|
case lval::DeclValKind:
|
||||||
|
@ -1467,10 +1467,10 @@ ValueState* GRExprEngine::Assume(ValueState* St, NonLVal Cond,
|
||||||
SymbolID sym = SV.getSymbol();
|
SymbolID sym = SV.getSymbol();
|
||||||
|
|
||||||
if (Assumption)
|
if (Assumption)
|
||||||
return AssumeSymNE(St, sym, ValMgr.getValue(0, SymMgr.getType(sym)),
|
return AssumeSymNE(St, sym, BasicVals.getValue(0, SymMgr.getType(sym)),
|
||||||
isFeasible);
|
isFeasible);
|
||||||
else
|
else
|
||||||
return AssumeSymEQ(St, sym, ValMgr.getValue(0, SymMgr.getType(sym)),
|
return AssumeSymEQ(St, sym, BasicVals.getValue(0, SymMgr.getType(sym)),
|
||||||
isFeasible);
|
isFeasible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,24 +153,24 @@ unsigned RunGRSimpleVals(CFG& cfg, FunctionDecl& FD, ASTContext& Ctx,
|
||||||
// Transfer function for Casts.
|
// 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))
|
if (!isa<nonlval::ConcreteInt>(X))
|
||||||
return UnknownVal();
|
return UnknownVal();
|
||||||
|
|
||||||
llvm::APSInt V = cast<nonlval::ConcreteInt>(X).getValue();
|
llvm::APSInt V = cast<nonlval::ConcreteInt>(X).getValue();
|
||||||
V.setIsUnsigned(T->isUnsignedIntegerType() || T->isPointerType());
|
V.setIsUnsigned(T->isUnsignedIntegerType() || T->isPointerType());
|
||||||
V.extOrTrunc(ValMgr.getContext().getTypeSize(T));
|
V.extOrTrunc(BasicVals.getContext().getTypeSize(T));
|
||||||
|
|
||||||
if (T->isPointerType())
|
if (T->isPointerType())
|
||||||
return lval::ConcreteInt(ValMgr.getValue(V));
|
return lval::ConcreteInt(BasicVals.getValue(V));
|
||||||
else
|
else
|
||||||
return nonlval::ConcreteInt(ValMgr.getValue(V));
|
return nonlval::ConcreteInt(BasicVals.getValue(V));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Casts.
|
// Casts.
|
||||||
|
|
||||||
RVal GRSimpleVals::EvalCast(ValueManager& ValMgr, LVal X, QualType T) {
|
RVal GRSimpleVals::EvalCast(BasicValueFactory& BasicVals, LVal X, QualType T) {
|
||||||
|
|
||||||
if (T->isPointerType() || T->isReferenceType())
|
if (T->isPointerType() || T->isReferenceType())
|
||||||
return X;
|
return X;
|
||||||
|
@ -182,31 +182,31 @@ RVal GRSimpleVals::EvalCast(ValueManager& ValMgr, LVal X, QualType T) {
|
||||||
|
|
||||||
llvm::APSInt V = cast<lval::ConcreteInt>(X).getValue();
|
llvm::APSInt V = cast<lval::ConcreteInt>(X).getValue();
|
||||||
V.setIsUnsigned(T->isUnsignedIntegerType() || T->isPointerType());
|
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.
|
// Unary operators.
|
||||||
|
|
||||||
RVal GRSimpleVals::EvalMinus(ValueManager& ValMgr, UnaryOperator* U, NonLVal X){
|
RVal GRSimpleVals::EvalMinus(BasicValueFactory& BasicVals, UnaryOperator* U, NonLVal X){
|
||||||
|
|
||||||
switch (X.getSubKind()) {
|
switch (X.getSubKind()) {
|
||||||
|
|
||||||
case nonlval::ConcreteIntKind:
|
case nonlval::ConcreteIntKind:
|
||||||
return cast<nonlval::ConcreteInt>(X).EvalMinus(ValMgr, U);
|
return cast<nonlval::ConcreteInt>(X).EvalMinus(BasicVals, U);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return UnknownVal();
|
return UnknownVal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RVal GRSimpleVals::EvalComplement(ValueManager& ValMgr, NonLVal X) {
|
RVal GRSimpleVals::EvalComplement(BasicValueFactory& BasicVals, NonLVal X) {
|
||||||
|
|
||||||
switch (X.getSubKind()) {
|
switch (X.getSubKind()) {
|
||||||
|
|
||||||
case nonlval::ConcreteIntKind:
|
case nonlval::ConcreteIntKind:
|
||||||
return cast<nonlval::ConcreteInt>(X).EvalComplement(ValMgr);
|
return cast<nonlval::ConcreteInt>(X).EvalComplement(BasicVals);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return UnknownVal();
|
return UnknownVal();
|
||||||
|
@ -215,7 +215,7 @@ RVal GRSimpleVals::EvalComplement(ValueManager& ValMgr, NonLVal X) {
|
||||||
|
|
||||||
// Binary operators.
|
// Binary operators.
|
||||||
|
|
||||||
RVal GRSimpleVals::EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
|
RVal GRSimpleVals::EvalBinOp(BasicValueFactory& BasicVals, BinaryOperator::Opcode Op,
|
||||||
NonLVal L, NonLVal R) {
|
NonLVal L, NonLVal R) {
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ RVal GRSimpleVals::EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
|
||||||
if (isa<nonlval::ConcreteInt>(R)) {
|
if (isa<nonlval::ConcreteInt>(R)) {
|
||||||
const nonlval::ConcreteInt& L_CI = cast<nonlval::ConcreteInt>(L);
|
const nonlval::ConcreteInt& L_CI = cast<nonlval::ConcreteInt>(L);
|
||||||
const nonlval::ConcreteInt& R_CI = cast<nonlval::ConcreteInt>(R);
|
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 {
|
else {
|
||||||
NonLVal tmp = R;
|
NonLVal tmp = R;
|
||||||
|
@ -241,7 +241,7 @@ RVal GRSimpleVals::EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
|
||||||
|
|
||||||
if (isa<nonlval::ConcreteInt>(R)) {
|
if (isa<nonlval::ConcreteInt>(R)) {
|
||||||
const SymIntConstraint& C =
|
const SymIntConstraint& C =
|
||||||
ValMgr.getConstraint(cast<nonlval::SymbolVal>(L).getSymbol(), Op,
|
BasicVals.getConstraint(cast<nonlval::SymbolVal>(L).getSymbol(), Op,
|
||||||
cast<nonlval::ConcreteInt>(R).getValue());
|
cast<nonlval::ConcreteInt>(R).getValue());
|
||||||
|
|
||||||
return nonlval::SymIntConstraintVal(C);
|
return nonlval::SymIntConstraintVal(C);
|
||||||
|
@ -256,7 +256,7 @@ RVal GRSimpleVals::EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
|
||||||
|
|
||||||
// Binary Operators (except assignments and comma).
|
// 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) {
|
LVal L, LVal R) {
|
||||||
|
|
||||||
switch (Op) {
|
switch (Op) {
|
||||||
|
@ -265,23 +265,23 @@ RVal GRSimpleVals::EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
|
||||||
return UnknownVal();
|
return UnknownVal();
|
||||||
|
|
||||||
case BinaryOperator::EQ:
|
case BinaryOperator::EQ:
|
||||||
return EvalEQ(ValMgr, L, R);
|
return EvalEQ(BasicVals, L, R);
|
||||||
|
|
||||||
case BinaryOperator::NE:
|
case BinaryOperator::NE:
|
||||||
return EvalNE(ValMgr, L, R);
|
return EvalNE(BasicVals, L, R);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pointer arithmetic.
|
// Pointer arithmetic.
|
||||||
|
|
||||||
RVal GRSimpleVals::EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
|
RVal GRSimpleVals::EvalBinOp(BasicValueFactory& BasicVals, BinaryOperator::Opcode Op,
|
||||||
LVal L, NonLVal R) {
|
LVal L, NonLVal R) {
|
||||||
return UnknownVal();
|
return UnknownVal();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Equality operators for LVals.
|
// 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()) {
|
switch (L.getSubKind()) {
|
||||||
|
|
||||||
|
@ -295,12 +295,12 @@ RVal GRSimpleVals::EvalEQ(ValueManager& ValMgr, LVal L, LVal R) {
|
||||||
bool b = cast<lval::ConcreteInt>(L).getValue() ==
|
bool b = cast<lval::ConcreteInt>(L).getValue() ==
|
||||||
cast<lval::ConcreteInt>(R).getValue();
|
cast<lval::ConcreteInt>(R).getValue();
|
||||||
|
|
||||||
return NonLVal::MakeIntTruthVal(ValMgr, b);
|
return NonLVal::MakeIntTruthVal(BasicVals, b);
|
||||||
}
|
}
|
||||||
else if (isa<lval::SymbolVal>(R)) {
|
else if (isa<lval::SymbolVal>(R)) {
|
||||||
|
|
||||||
const SymIntConstraint& C =
|
const SymIntConstraint& C =
|
||||||
ValMgr.getConstraint(cast<lval::SymbolVal>(R).getSymbol(),
|
BasicVals.getConstraint(cast<lval::SymbolVal>(R).getSymbol(),
|
||||||
BinaryOperator::EQ,
|
BinaryOperator::EQ,
|
||||||
cast<lval::ConcreteInt>(L).getValue());
|
cast<lval::ConcreteInt>(L).getValue());
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ RVal GRSimpleVals::EvalEQ(ValueManager& ValMgr, LVal L, LVal R) {
|
||||||
|
|
||||||
if (isa<lval::ConcreteInt>(R)) {
|
if (isa<lval::ConcreteInt>(R)) {
|
||||||
const SymIntConstraint& C =
|
const SymIntConstraint& C =
|
||||||
ValMgr.getConstraint(cast<lval::SymbolVal>(L).getSymbol(),
|
BasicVals.getConstraint(cast<lval::SymbolVal>(L).getSymbol(),
|
||||||
BinaryOperator::EQ,
|
BinaryOperator::EQ,
|
||||||
cast<lval::ConcreteInt>(R).getValue());
|
cast<lval::ConcreteInt>(R).getValue());
|
||||||
|
|
||||||
|
@ -331,13 +331,13 @@ RVal GRSimpleVals::EvalEQ(ValueManager& ValMgr, LVal L, LVal R) {
|
||||||
case lval::DeclValKind:
|
case lval::DeclValKind:
|
||||||
case lval::FuncValKind:
|
case lval::FuncValKind:
|
||||||
case lval::GotoLabelKind:
|
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()) {
|
switch (L.getSubKind()) {
|
||||||
|
|
||||||
|
@ -351,11 +351,11 @@ RVal GRSimpleVals::EvalNE(ValueManager& ValMgr, LVal L, LVal R) {
|
||||||
bool b = cast<lval::ConcreteInt>(L).getValue() !=
|
bool b = cast<lval::ConcreteInt>(L).getValue() !=
|
||||||
cast<lval::ConcreteInt>(R).getValue();
|
cast<lval::ConcreteInt>(R).getValue();
|
||||||
|
|
||||||
return NonLVal::MakeIntTruthVal(ValMgr, b);
|
return NonLVal::MakeIntTruthVal(BasicVals, b);
|
||||||
}
|
}
|
||||||
else if (isa<lval::SymbolVal>(R)) {
|
else if (isa<lval::SymbolVal>(R)) {
|
||||||
const SymIntConstraint& C =
|
const SymIntConstraint& C =
|
||||||
ValMgr.getConstraint(cast<lval::SymbolVal>(R).getSymbol(),
|
BasicVals.getConstraint(cast<lval::SymbolVal>(R).getSymbol(),
|
||||||
BinaryOperator::NE,
|
BinaryOperator::NE,
|
||||||
cast<lval::ConcreteInt>(L).getValue());
|
cast<lval::ConcreteInt>(L).getValue());
|
||||||
|
|
||||||
|
@ -367,7 +367,7 @@ RVal GRSimpleVals::EvalNE(ValueManager& ValMgr, LVal L, LVal R) {
|
||||||
case lval::SymbolValKind: {
|
case lval::SymbolValKind: {
|
||||||
if (isa<lval::ConcreteInt>(R)) {
|
if (isa<lval::ConcreteInt>(R)) {
|
||||||
const SymIntConstraint& C =
|
const SymIntConstraint& C =
|
||||||
ValMgr.getConstraint(cast<lval::SymbolVal>(L).getSymbol(),
|
BasicVals.getConstraint(cast<lval::SymbolVal>(L).getSymbol(),
|
||||||
BinaryOperator::NE,
|
BinaryOperator::NE,
|
||||||
cast<lval::ConcreteInt>(R).getValue());
|
cast<lval::ConcreteInt>(R).getValue());
|
||||||
|
|
||||||
|
@ -387,10 +387,10 @@ RVal GRSimpleVals::EvalNE(ValueManager& ValMgr, LVal L, LVal R) {
|
||||||
case lval::DeclValKind:
|
case lval::DeclValKind:
|
||||||
case lval::FuncValKind:
|
case lval::FuncValKind:
|
||||||
case lval::GotoLabelKind:
|
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 @@ RVal GRSimpleVals::EvalNE(ValueManager& ValMgr, LVal L, LVal R) {
|
||||||
void GRSimpleVals::EvalCall(ExplodedNodeSet<ValueState>& Dst,
|
void GRSimpleVals::EvalCall(ExplodedNodeSet<ValueState>& Dst,
|
||||||
ValueStateManager& StateMgr,
|
ValueStateManager& StateMgr,
|
||||||
GRStmtNodeBuilder<ValueState>& Builder,
|
GRStmtNodeBuilder<ValueState>& Builder,
|
||||||
ValueManager& ValMgr,
|
BasicValueFactory& BasicVals,
|
||||||
CallExpr* CE, LVal L,
|
CallExpr* CE, LVal L,
|
||||||
ExplodedNode<ValueState>* Pred) {
|
ExplodedNode<ValueState>* Pred) {
|
||||||
|
|
||||||
|
|
|
@ -28,26 +28,26 @@ public:
|
||||||
|
|
||||||
// Casts.
|
// Casts.
|
||||||
|
|
||||||
virtual RVal EvalCast(ValueManager& ValMgr, NonLVal V, QualType CastT);
|
virtual RVal EvalCast(BasicValueFactory& BasicVals, NonLVal V, QualType CastT);
|
||||||
virtual RVal EvalCast(ValueManager& ValMgr, LVal V, QualType CastT);
|
virtual RVal EvalCast(BasicValueFactory& BasicVals, LVal V, QualType CastT);
|
||||||
|
|
||||||
// Unary Operators.
|
// 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.
|
// Binary Operators.
|
||||||
|
|
||||||
virtual RVal EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
|
virtual RVal EvalBinOp(BasicValueFactory& BasicVals, BinaryOperator::Opcode Op,
|
||||||
NonLVal L, NonLVal R);
|
NonLVal L, NonLVal R);
|
||||||
|
|
||||||
virtual RVal EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
|
virtual RVal EvalBinOp(BasicValueFactory& BasicVals, BinaryOperator::Opcode Op,
|
||||||
LVal L, LVal R);
|
LVal L, LVal R);
|
||||||
|
|
||||||
// Pointer arithmetic.
|
// Pointer arithmetic.
|
||||||
|
|
||||||
virtual RVal EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
|
virtual RVal EvalBinOp(BasicValueFactory& BasicVals, BinaryOperator::Opcode Op,
|
||||||
LVal L, NonLVal R);
|
LVal L, NonLVal R);
|
||||||
|
|
||||||
// Calls.
|
// Calls.
|
||||||
|
@ -55,7 +55,7 @@ public:
|
||||||
virtual void EvalCall(ExplodedNodeSet<ValueState>& Dst,
|
virtual void EvalCall(ExplodedNodeSet<ValueState>& Dst,
|
||||||
ValueStateManager& StateMgr,
|
ValueStateManager& StateMgr,
|
||||||
GRStmtNodeBuilder<ValueState>& Builder,
|
GRStmtNodeBuilder<ValueState>& Builder,
|
||||||
ValueManager& ValMgr,
|
BasicValueFactory& BasicVals,
|
||||||
CallExpr* CE, LVal L,
|
CallExpr* CE, LVal L,
|
||||||
ExplodedNode<ValueState>* Pred);
|
ExplodedNode<ValueState>* Pred);
|
||||||
|
|
||||||
|
@ -63,8 +63,8 @@ protected:
|
||||||
|
|
||||||
// Equality operators for LVals.
|
// Equality operators for LVals.
|
||||||
|
|
||||||
RVal EvalEQ(ValueManager& ValMgr, LVal L, LVal R);
|
RVal EvalEQ(BasicValueFactory& BasicVals, LVal L, LVal R);
|
||||||
RVal EvalNE(ValueManager& ValMgr, LVal L, LVal R);
|
RVal EvalNE(BasicValueFactory& BasicVals, LVal L, LVal R);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end clang namespace
|
} // end clang namespace
|
||||||
|
|
|
@ -49,10 +49,10 @@ RVal::symbol_iterator RVal::symbol_end() const {
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
RVal
|
RVal
|
||||||
nonlval::ConcreteInt::EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
|
nonlval::ConcreteInt::EvalBinOp(BasicValueFactory& BasicVals, BinaryOperator::Opcode Op,
|
||||||
const nonlval::ConcreteInt& R) const {
|
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)
|
if (X)
|
||||||
return nonlval::ConcreteInt(*X);
|
return nonlval::ConcreteInt(*X);
|
||||||
|
@ -64,17 +64,17 @@ nonlval::ConcreteInt::EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
|
||||||
// Bitwise-Complement.
|
// Bitwise-Complement.
|
||||||
|
|
||||||
nonlval::ConcreteInt
|
nonlval::ConcreteInt
|
||||||
nonlval::ConcreteInt::EvalComplement(ValueManager& ValMgr) const {
|
nonlval::ConcreteInt::EvalComplement(BasicValueFactory& BasicVals) const {
|
||||||
return ValMgr.getValue(~getValue());
|
return BasicVals.getValue(~getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unary Minus.
|
// Unary Minus.
|
||||||
|
|
||||||
nonlval::ConcreteInt
|
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() == U->getSubExpr()->getType());
|
||||||
assert (U->getType()->isIntegerType());
|
assert (U->getType()->isIntegerType());
|
||||||
return ValMgr.getValue(-getValue());
|
return BasicVals.getValue(-getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
@ -82,13 +82,13 @@ nonlval::ConcreteInt::EvalMinus(ValueManager& ValMgr, UnaryOperator* U) const {
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
RVal
|
RVal
|
||||||
lval::ConcreteInt::EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
|
lval::ConcreteInt::EvalBinOp(BasicValueFactory& BasicVals, BinaryOperator::Opcode Op,
|
||||||
const lval::ConcreteInt& R) const {
|
const lval::ConcreteInt& R) const {
|
||||||
|
|
||||||
assert (Op == BinaryOperator::Add || Op == BinaryOperator::Sub ||
|
assert (Op == BinaryOperator::Add || Op == BinaryOperator::Sub ||
|
||||||
(Op >= BinaryOperator::LT && Op <= BinaryOperator::NE));
|
(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)
|
if (X)
|
||||||
return lval::ConcreteInt(*X);
|
return lval::ConcreteInt(*X);
|
||||||
|
@ -96,7 +96,7 @@ lval::ConcreteInt::EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
|
||||||
return UndefinedVal();
|
return UndefinedVal();
|
||||||
}
|
}
|
||||||
|
|
||||||
NonLVal LVal::EQ(ValueManager& ValMgr, const LVal& R) const {
|
NonLVal LVal::EQ(BasicValueFactory& BasicVals, const LVal& R) const {
|
||||||
|
|
||||||
switch (getSubKind()) {
|
switch (getSubKind()) {
|
||||||
default:
|
default:
|
||||||
|
@ -108,12 +108,12 @@ NonLVal LVal::EQ(ValueManager& ValMgr, const LVal& R) const {
|
||||||
bool b = cast<lval::ConcreteInt>(this)->getValue() ==
|
bool b = cast<lval::ConcreteInt>(this)->getValue() ==
|
||||||
cast<lval::ConcreteInt>(R).getValue();
|
cast<lval::ConcreteInt>(R).getValue();
|
||||||
|
|
||||||
return NonLVal::MakeIntTruthVal(ValMgr, b);
|
return NonLVal::MakeIntTruthVal(BasicVals, b);
|
||||||
}
|
}
|
||||||
else if (isa<lval::SymbolVal>(R)) {
|
else if (isa<lval::SymbolVal>(R)) {
|
||||||
|
|
||||||
const SymIntConstraint& C =
|
const SymIntConstraint& C =
|
||||||
ValMgr.getConstraint(cast<lval::SymbolVal>(R).getSymbol(),
|
BasicVals.getConstraint(cast<lval::SymbolVal>(R).getSymbol(),
|
||||||
BinaryOperator::EQ,
|
BinaryOperator::EQ,
|
||||||
cast<lval::ConcreteInt>(this)->getValue());
|
cast<lval::ConcreteInt>(this)->getValue());
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ NonLVal LVal::EQ(ValueManager& ValMgr, const LVal& R) const {
|
||||||
if (isa<lval::ConcreteInt>(R)) {
|
if (isa<lval::ConcreteInt>(R)) {
|
||||||
|
|
||||||
const SymIntConstraint& C =
|
const SymIntConstraint& C =
|
||||||
ValMgr.getConstraint(cast<lval::SymbolVal>(this)->getSymbol(),
|
BasicVals.getConstraint(cast<lval::SymbolVal>(this)->getSymbol(),
|
||||||
BinaryOperator::EQ,
|
BinaryOperator::EQ,
|
||||||
cast<lval::ConcreteInt>(R).getValue());
|
cast<lval::ConcreteInt>(R).getValue());
|
||||||
|
|
||||||
|
@ -141,16 +141,16 @@ NonLVal LVal::EQ(ValueManager& ValMgr, const LVal& R) const {
|
||||||
case lval::DeclValKind:
|
case lval::DeclValKind:
|
||||||
if (isa<lval::DeclVal>(R)) {
|
if (isa<lval::DeclVal>(R)) {
|
||||||
bool b = cast<lval::DeclVal>(*this) == cast<lval::DeclVal>(R);
|
bool b = cast<lval::DeclVal>(*this) == cast<lval::DeclVal>(R);
|
||||||
return NonLVal::MakeIntTruthVal(ValMgr, b);
|
return NonLVal::MakeIntTruthVal(BasicVals, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
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()) {
|
switch (getSubKind()) {
|
||||||
default:
|
default:
|
||||||
assert(false && "NE not implemented for this LVal.");
|
assert(false && "NE not implemented for this LVal.");
|
||||||
|
@ -161,12 +161,12 @@ NonLVal LVal::NE(ValueManager& ValMgr, const LVal& R) const {
|
||||||
bool b = cast<lval::ConcreteInt>(this)->getValue() !=
|
bool b = cast<lval::ConcreteInt>(this)->getValue() !=
|
||||||
cast<lval::ConcreteInt>(R).getValue();
|
cast<lval::ConcreteInt>(R).getValue();
|
||||||
|
|
||||||
return NonLVal::MakeIntTruthVal(ValMgr, b);
|
return NonLVal::MakeIntTruthVal(BasicVals, b);
|
||||||
}
|
}
|
||||||
else if (isa<lval::SymbolVal>(R)) {
|
else if (isa<lval::SymbolVal>(R)) {
|
||||||
|
|
||||||
const SymIntConstraint& C =
|
const SymIntConstraint& C =
|
||||||
ValMgr.getConstraint(cast<lval::SymbolVal>(R).getSymbol(),
|
BasicVals.getConstraint(cast<lval::SymbolVal>(R).getSymbol(),
|
||||||
BinaryOperator::NE,
|
BinaryOperator::NE,
|
||||||
cast<lval::ConcreteInt>(this)->getValue());
|
cast<lval::ConcreteInt>(this)->getValue());
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ NonLVal LVal::NE(ValueManager& ValMgr, const LVal& R) const {
|
||||||
if (isa<lval::ConcreteInt>(R)) {
|
if (isa<lval::ConcreteInt>(R)) {
|
||||||
|
|
||||||
const SymIntConstraint& C =
|
const SymIntConstraint& C =
|
||||||
ValMgr.getConstraint(cast<lval::SymbolVal>(this)->getSymbol(),
|
BasicVals.getConstraint(cast<lval::SymbolVal>(this)->getSymbol(),
|
||||||
BinaryOperator::NE,
|
BinaryOperator::NE,
|
||||||
cast<lval::ConcreteInt>(R).getValue());
|
cast<lval::ConcreteInt>(R).getValue());
|
||||||
|
|
||||||
|
@ -194,31 +194,31 @@ NonLVal LVal::NE(ValueManager& ValMgr, const LVal& R) const {
|
||||||
case lval::DeclValKind:
|
case lval::DeclValKind:
|
||||||
if (isa<lval::DeclVal>(R)) {
|
if (isa<lval::DeclVal>(R)) {
|
||||||
bool b = cast<lval::DeclVal>(*this) == cast<lval::DeclVal>(R);
|
bool b = cast<lval::DeclVal>(*this) == cast<lval::DeclVal>(R);
|
||||||
return NonLVal::MakeIntTruthVal(ValMgr, b);
|
return NonLVal::MakeIntTruthVal(BasicVals, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NonLVal::MakeIntTruthVal(ValMgr, true);
|
return NonLVal::MakeIntTruthVal(BasicVals, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Utility methods for constructing Non-LVals.
|
// Utility methods for constructing Non-LVals.
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
NonLVal NonLVal::MakeVal(ValueManager& ValMgr, uint64_t X, QualType T) {
|
NonLVal NonLVal::MakeVal(BasicValueFactory& BasicVals, uint64_t X, QualType T) {
|
||||||
return nonlval::ConcreteInt(ValMgr.getValue(X, 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())));
|
I->getType()->isUnsignedIntegerType())));
|
||||||
}
|
}
|
||||||
|
|
||||||
NonLVal NonLVal::MakeIntTruthVal(ValueManager& ValMgr, bool b) {
|
NonLVal NonLVal::MakeIntTruthVal(BasicValueFactory& BasicVals, bool b) {
|
||||||
return nonlval::ConcreteInt(ValMgr.getTruthValue(b));
|
return nonlval::ConcreteInt(BasicVals.getTruthValue(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
RVal RVal::GetSymbolValue(SymbolManager& SymMgr, VarDecl* D) {
|
RVal RVal::GetSymbolValue(SymbolManager& SymMgr, VarDecl* D) {
|
||||||
|
|
|
@ -245,7 +245,7 @@ RVal ValueStateManager::GetRVal(ValueState* St, Expr* E) {
|
||||||
// are comparing states using pointer equality. Perhaps there is
|
// are comparing states using pointer equality. Perhaps there is
|
||||||
// a better way, since APInts are fairly lightweight.
|
// 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))
|
else if (FunctionDecl* FD = dyn_cast<FunctionDecl>(D))
|
||||||
return lval::FuncVal(FD);
|
return lval::FuncVal(FD);
|
||||||
|
@ -258,11 +258,11 @@ RVal ValueStateManager::GetRVal(ValueState* St, Expr* E) {
|
||||||
|
|
||||||
case Stmt::CharacterLiteralClass: {
|
case Stmt::CharacterLiteralClass: {
|
||||||
CharacterLiteral* C = cast<CharacterLiteral>(E);
|
CharacterLiteral* C = cast<CharacterLiteral>(E);
|
||||||
return NonLVal::MakeVal(ValMgr, C->getValue(), C->getType());
|
return NonLVal::MakeVal(BasicVals, C->getValue(), C->getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
case Stmt::IntegerLiteralClass: {
|
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
|
// Casts where the source and target type are the same
|
||||||
|
@ -339,11 +339,11 @@ RVal ValueStateManager::GetBlkExprRVal(ValueState* St, Expr* E) {
|
||||||
switch (E->getStmtClass()) {
|
switch (E->getStmtClass()) {
|
||||||
case Stmt::CharacterLiteralClass: {
|
case Stmt::CharacterLiteralClass: {
|
||||||
CharacterLiteral* C = cast<CharacterLiteral>(E);
|
CharacterLiteral* C = cast<CharacterLiteral>(E);
|
||||||
return NonLVal::MakeVal(ValMgr, C->getValue(), C->getType());
|
return NonLVal::MakeVal(BasicVals, C->getValue(), C->getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
case Stmt::IntegerLiteralClass: {
|
case Stmt::IntegerLiteralClass: {
|
||||||
return NonLVal::MakeVal(ValMgr, cast<IntegerLiteral>(E));
|
return NonLVal::MakeVal(BasicVals, cast<IntegerLiteral>(E));
|
||||||
}
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
35BB2D7D0D19951A00944DB5 /* TranslationUnit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 35BB2D7C0D19951A00944DB5 /* TranslationUnit.cpp */; };
|
35BB2D7D0D19951A00944DB5 /* TranslationUnit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 35BB2D7C0D19951A00944DB5 /* TranslationUnit.cpp */; };
|
||||||
35BB2D7F0D19954000944DB5 /* ASTConsumer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 35BB2D7E0D19954000944DB5 /* ASTConsumer.cpp */; };
|
35BB2D7F0D19954000944DB5 /* ASTConsumer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 35BB2D7E0D19954000944DB5 /* ASTConsumer.cpp */; };
|
||||||
35CFFE000CA1CBCB00E6F2BE /* StmtViz.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 35CFFDFF0CA1CBCB00E6F2BE /* StmtViz.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 */; };
|
84AF36A10CB17A3B00C820A5 /* DeclObjC.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84AF36A00CB17A3B00C820A5 /* DeclObjC.h */; };
|
||||||
84D9A8880C1A57E100AC7ABC /* AttributeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84D9A8870C1A57E100AC7ABC /* AttributeList.cpp */; };
|
84D9A8880C1A57E100AC7ABC /* AttributeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84D9A8870C1A57E100AC7ABC /* AttributeList.cpp */; };
|
||||||
84D9A88C0C1A581300AC7ABC /* AttributeList.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 84D9A88B0C1A581300AC7ABC /* AttributeList.h */; };
|
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 */; };
|
DE4121360D7F1C1C0080F80A /* ExplodedGraph.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE4121280D7F1C1C0080F80A /* ExplodedGraph.cpp */; };
|
||||||
DE4121370D7F1C1C0080F80A /* UninitializedValues.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE4121290D7F1C1C0080F80A /* UninitializedValues.cpp */; };
|
DE4121370D7F1C1C0080F80A /* UninitializedValues.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE4121290D7F1C1C0080F80A /* UninitializedValues.cpp */; };
|
||||||
DE4121380D7F1C1C0080F80A /* GRCoreEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE41212A0D7F1C1C0080F80A /* GRCoreEngine.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 */; };
|
DE41213A0D7F1C1C0080F80A /* LiveVariables.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE41212D0D7F1C1C0080F80A /* LiveVariables.cpp */; };
|
||||||
DE41213B0D7F1C1C0080F80A /* RValues.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE41212E0D7F1C1C0080F80A /* RValues.cpp */; };
|
DE41213B0D7F1C1C0080F80A /* RValues.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE41212E0D7F1C1C0080F80A /* RValues.cpp */; };
|
||||||
DE41213C0D7F1C1C0080F80A /* GRSimpleVals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE41212F0D7F1C1C0080F80A /* GRSimpleVals.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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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 */ = {
|
356EF9B30C8F7DCA006650F5 /* Analysis */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
35D55B240D81D8C60092E734 /* BasicValueFactory.cpp */,
|
||||||
|
35D55B250D81D8C60092E734 /* CFRefCount.cpp */,
|
||||||
|
35D55B260D81D8C60092E734 /* CFRefCount.h */,
|
||||||
356EF9B40C8F7DDF006650F5 /* LiveVariables.cpp */,
|
356EF9B40C8F7DDF006650F5 /* LiveVariables.cpp */,
|
||||||
DE4121250D7F1C1C0080F80A /* ValueState.cpp */,
|
DE4121250D7F1C1C0080F80A /* ValueState.cpp */,
|
||||||
DE4121260D7F1C1C0080F80A /* DeadStores.cpp */,
|
DE4121260D7F1C1C0080F80A /* DeadStores.cpp */,
|
||||||
|
@ -502,7 +508,6 @@
|
||||||
DE4121280D7F1C1C0080F80A /* ExplodedGraph.cpp */,
|
DE4121280D7F1C1C0080F80A /* ExplodedGraph.cpp */,
|
||||||
DE4121290D7F1C1C0080F80A /* UninitializedValues.cpp */,
|
DE4121290D7F1C1C0080F80A /* UninitializedValues.cpp */,
|
||||||
DE41212A0D7F1C1C0080F80A /* GRCoreEngine.cpp */,
|
DE41212A0D7F1C1C0080F80A /* GRCoreEngine.cpp */,
|
||||||
DE41212B0D7F1C1C0080F80A /* ValueManager.cpp */,
|
|
||||||
DE41212C0D7F1C1C0080F80A /* GRSimpleVals.h */,
|
DE41212C0D7F1C1C0080F80A /* GRSimpleVals.h */,
|
||||||
DE41212D0D7F1C1C0080F80A /* LiveVariables.cpp */,
|
DE41212D0D7F1C1C0080F80A /* LiveVariables.cpp */,
|
||||||
DE41212E0D7F1C1C0080F80A /* RValues.cpp */,
|
DE41212E0D7F1C1C0080F80A /* RValues.cpp */,
|
||||||
|
@ -584,7 +589,7 @@
|
||||||
DE4121130D7F1B980080F80A /* PathSensitive */ = {
|
DE4121130D7F1B980080F80A /* PathSensitive */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
DE41211A0D7F1BBE0080F80A /* ValueManager.h */,
|
35D55B290D81D8E50092E734 /* BasicValueFactory.h */,
|
||||||
DE41211B0D7F1BBE0080F80A /* RValues.h */,
|
DE41211B0D7F1BBE0080F80A /* RValues.h */,
|
||||||
DE41211C0D7F1BBE0080F80A /* ValueState.h */,
|
DE41211C0D7F1BBE0080F80A /* ValueState.h */,
|
||||||
DE41211D0D7F1BBE0080F80A /* GRWorkList.h */,
|
DE41211D0D7F1BBE0080F80A /* GRWorkList.h */,
|
||||||
|
@ -970,13 +975,14 @@
|
||||||
DE4121360D7F1C1C0080F80A /* ExplodedGraph.cpp in Sources */,
|
DE4121360D7F1C1C0080F80A /* ExplodedGraph.cpp in Sources */,
|
||||||
DE4121370D7F1C1C0080F80A /* UninitializedValues.cpp in Sources */,
|
DE4121370D7F1C1C0080F80A /* UninitializedValues.cpp in Sources */,
|
||||||
DE4121380D7F1C1C0080F80A /* GRCoreEngine.cpp in Sources */,
|
DE4121380D7F1C1C0080F80A /* GRCoreEngine.cpp in Sources */,
|
||||||
DE4121390D7F1C1C0080F80A /* ValueManager.cpp in Sources */,
|
|
||||||
DE41213A0D7F1C1C0080F80A /* LiveVariables.cpp in Sources */,
|
DE41213A0D7F1C1C0080F80A /* LiveVariables.cpp in Sources */,
|
||||||
DE41213B0D7F1C1C0080F80A /* RValues.cpp in Sources */,
|
DE41213B0D7F1C1C0080F80A /* RValues.cpp in Sources */,
|
||||||
DE41213C0D7F1C1C0080F80A /* GRSimpleVals.cpp in Sources */,
|
DE41213C0D7F1C1C0080F80A /* GRSimpleVals.cpp in Sources */,
|
||||||
DE41213D0D7F1C1C0080F80A /* GRBlockCounter.cpp in Sources */,
|
DE41213D0D7F1C1C0080F80A /* GRBlockCounter.cpp in Sources */,
|
||||||
DE41213E0D7F1C1C0080F80A /* GRExprEngine.cpp in Sources */,
|
DE41213E0D7F1C1C0080F80A /* GRExprEngine.cpp in Sources */,
|
||||||
DE41213F0D7F1C1C0080F80A /* ProgramPoint.cpp in Sources */,
|
DE41213F0D7F1C1C0080F80A /* ProgramPoint.cpp in Sources */,
|
||||||
|
35D55B270D81D8C60092E734 /* BasicValueFactory.cpp in Sources */,
|
||||||
|
35D55B280D81D8C60092E734 /* CFRefCount.cpp in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -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
|
// The LLVM Compiler Infrastructure
|
||||||
//
|
//
|
||||||
|
@ -7,13 +7,14 @@
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
//
|
//
|
||||||
// This file defines ValueManager, a class that manages the lifetime of APSInt
|
// This file defines BasicValueFactory, a class that manages the lifetime
|
||||||
// objects and symbolic constraints used by GRExprEngine and related classes.
|
// of APSInt objects and symbolic constraints used by GRExprEngine
|
||||||
|
// and related classes.
|
||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#ifndef LLVM_CLANG_ANALYSIS_VALUEMANAGER_H
|
#ifndef LLVM_CLANG_ANALYSIS_BASICVALUEFACTORY_H
|
||||||
#define LLVM_CLANG_ANALYSIS_VALUEMANAGER_H
|
#define LLVM_CLANG_ANALYSIS_BASICVALUEFACTORY_H
|
||||||
|
|
||||||
#include "clang/Analysis/PathSensitive/SymbolManager.h"
|
#include "clang/Analysis/PathSensitive/SymbolManager.h"
|
||||||
#include "clang/AST/ASTContext.h"
|
#include "clang/AST/ASTContext.h"
|
||||||
|
@ -26,7 +27,7 @@ namespace llvm {
|
||||||
|
|
||||||
namespace clang {
|
namespace clang {
|
||||||
|
|
||||||
class ValueManager {
|
class BasicValueFactory {
|
||||||
typedef llvm::FoldingSet<llvm::FoldingSetNodeWrapper<llvm::APSInt> >
|
typedef llvm::FoldingSet<llvm::FoldingSetNodeWrapper<llvm::APSInt> >
|
||||||
APSIntSetTy;
|
APSIntSetTy;
|
||||||
|
|
||||||
|
@ -40,10 +41,10 @@ class ValueManager {
|
||||||
SymIntCSetTy SymIntCSet;
|
SymIntCSetTy SymIntCSet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ValueManager(ASTContext& ctx, llvm::BumpPtrAllocator& Alloc)
|
BasicValueFactory(ASTContext& ctx, llvm::BumpPtrAllocator& Alloc)
|
||||||
: Ctx(ctx), BPAlloc(Alloc) {}
|
: Ctx(ctx), BPAlloc(Alloc) {}
|
||||||
|
|
||||||
~ValueManager();
|
~BasicValueFactory();
|
||||||
|
|
||||||
ASTContext& getContext() const { return Ctx; }
|
ASTContext& getContext() const { return Ctx; }
|
||||||
|
|
|
@ -49,7 +49,7 @@ protected:
|
||||||
ValueStateManager StateMgr;
|
ValueStateManager StateMgr;
|
||||||
|
|
||||||
/// ValueMgr - Object that manages the data for all created RVals.
|
/// ValueMgr - Object that manages the data for all created RVals.
|
||||||
ValueManager& ValMgr;
|
BasicValueFactory& BasicVals;
|
||||||
|
|
||||||
/// TF - Object that represents a bundle of transfer functions
|
/// TF - Object that represents a bundle of transfer functions
|
||||||
/// for manipulating and creating RVals.
|
/// for manipulating and creating RVals.
|
||||||
|
@ -127,7 +127,7 @@ public:
|
||||||
G(g), Liveness(G.getCFG(), G.getFunctionDecl()),
|
G(g), Liveness(G.getCFG(), G.getFunctionDecl()),
|
||||||
Builder(NULL),
|
Builder(NULL),
|
||||||
StateMgr(G.getContext(), G.getAllocator()),
|
StateMgr(G.getContext(), G.getAllocator()),
|
||||||
ValMgr(StateMgr.getValueManager()),
|
BasicVals(StateMgr.getBasicValueFactory()),
|
||||||
TF(NULL), // FIXME.
|
TF(NULL), // FIXME.
|
||||||
SymMgr(StateMgr.getSymbolManager()),
|
SymMgr(StateMgr.getSymbolManager()),
|
||||||
StmtEntryNode(NULL), CurrentStmt(NULL) {
|
StmtEntryNode(NULL), CurrentStmt(NULL) {
|
||||||
|
@ -310,7 +310,7 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
inline NonLVal MakeConstantVal(uint64_t X, Expr* Ex) {
|
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
|
/// Assume - Create new state by assuming that a given expression
|
||||||
|
@ -399,25 +399,25 @@ protected:
|
||||||
return X;
|
return X;
|
||||||
|
|
||||||
if (isa<LVal>(X))
|
if (isa<LVal>(X))
|
||||||
return TF->EvalCast(ValMgr, cast<LVal>(X), CastT);
|
return TF->EvalCast(BasicVals, cast<LVal>(X), CastT);
|
||||||
else
|
else
|
||||||
return TF->EvalCast(ValMgr, cast<NonLVal>(X), CastT);
|
return TF->EvalCast(BasicVals, cast<NonLVal>(X), CastT);
|
||||||
}
|
}
|
||||||
|
|
||||||
RVal EvalMinus(UnaryOperator* U, RVal X) {
|
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) {
|
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) {
|
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) {
|
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) {
|
RVal EvalBinOp(BinaryOperator::Opcode Op, RVal L, RVal R) {
|
||||||
|
@ -430,17 +430,17 @@ protected:
|
||||||
|
|
||||||
if (isa<LVal>(L)) {
|
if (isa<LVal>(L)) {
|
||||||
if (isa<LVal>(R))
|
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
|
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) {
|
void EvalCall(NodeSet& Dst, CallExpr* CE, LVal L, NodeTy* Pred) {
|
||||||
assert (Builder && "GRStmtNodeBuilder must be defined.");
|
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);
|
ValueState* MarkBranch(ValueState* St, Stmt* Terminator, bool branchTaken);
|
||||||
|
|
|
@ -30,26 +30,26 @@ public:
|
||||||
|
|
||||||
// Casts.
|
// Casts.
|
||||||
|
|
||||||
virtual RVal EvalCast(ValueManager& ValMgr, NonLVal V, QualType CastT) =0;
|
virtual RVal EvalCast(BasicValueFactory& BasicVals, NonLVal V, QualType CastT) =0;
|
||||||
virtual RVal EvalCast(ValueManager& ValMgr, LVal V, QualType CastT) = 0;
|
virtual RVal EvalCast(BasicValueFactory& BasicVals, LVal V, QualType CastT) = 0;
|
||||||
|
|
||||||
// Unary Operators.
|
// 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.
|
// Binary Operators.
|
||||||
|
|
||||||
virtual RVal EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
|
virtual RVal EvalBinOp(BasicValueFactory& BasicVals, BinaryOperator::Opcode Op,
|
||||||
NonLVal L, NonLVal R) = 0;
|
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;
|
LVal L, LVal R) = 0;
|
||||||
|
|
||||||
// Pointer arithmetic.
|
// Pointer arithmetic.
|
||||||
|
|
||||||
virtual RVal EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
|
virtual RVal EvalBinOp(BasicValueFactory& BasicVals, BinaryOperator::Opcode Op,
|
||||||
LVal L, NonLVal R) = 0;
|
LVal L, NonLVal R) = 0;
|
||||||
|
|
||||||
// Calls.
|
// Calls.
|
||||||
|
@ -57,7 +57,7 @@ public:
|
||||||
virtual void EvalCall(ExplodedNodeSet<ValueState>& Dst,
|
virtual void EvalCall(ExplodedNodeSet<ValueState>& Dst,
|
||||||
ValueStateManager& StateMgr,
|
ValueStateManager& StateMgr,
|
||||||
GRStmtNodeBuilder<ValueState>& Builder,
|
GRStmtNodeBuilder<ValueState>& Builder,
|
||||||
ValueManager& ValMgr, CallExpr* CE, LVal L,
|
BasicValueFactory& BasicVals, CallExpr* CE, LVal L,
|
||||||
ExplodedNode<ValueState>* Pred) = 0;
|
ExplodedNode<ValueState>* Pred) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#ifndef LLVM_CLANG_ANALYSIS_RVALUE_H
|
#ifndef LLVM_CLANG_ANALYSIS_RVALUE_H
|
||||||
#define 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"
|
#include "llvm/Support/Casting.h"
|
||||||
|
|
||||||
//==------------------------------------------------------------------------==//
|
//==------------------------------------------------------------------------==//
|
||||||
|
@ -123,11 +123,11 @@ public:
|
||||||
void print(std::ostream& Out) const;
|
void print(std::ostream& Out) const;
|
||||||
|
|
||||||
// Utility methods to create NonLVals.
|
// 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.
|
// Implement isa<T> support.
|
||||||
static inline bool classof(const RVal* V) {
|
static inline bool classof(const RVal* V) {
|
||||||
|
@ -141,8 +141,8 @@ protected:
|
||||||
: RVal(const_cast<void*>(D), true, SubKind) {}
|
: RVal(const_cast<void*>(D), true, SubKind) {}
|
||||||
|
|
||||||
// Equality operators.
|
// Equality operators.
|
||||||
NonLVal EQ(ValueManager& ValMgr, const LVal& R) const;
|
NonLVal EQ(BasicValueFactory& BasicVals, const LVal& R) const;
|
||||||
NonLVal NE(ValueManager& ValMgr, const LVal& R) const;
|
NonLVal NE(BasicValueFactory& BasicVals, const LVal& R) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void print(std::ostream& Out) const;
|
void print(std::ostream& Out) const;
|
||||||
|
@ -210,12 +210,12 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transfer functions for binary/unary operations on ConcreteInts.
|
// 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;
|
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.
|
// Implement isa<T> support.
|
||||||
static inline bool classof(const RVal* V) {
|
static inline bool classof(const RVal* V) {
|
||||||
|
@ -340,7 +340,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transfer functions for binary/unary operations on ConcreteInts.
|
// 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;
|
const ConcreteInt& R) const;
|
||||||
|
|
||||||
// Implement isa<T> support.
|
// Implement isa<T> support.
|
||||||
|
|
|
@ -169,7 +169,7 @@ private:
|
||||||
llvm::FoldingSet<ValueState> StateSet;
|
llvm::FoldingSet<ValueState> StateSet;
|
||||||
|
|
||||||
/// ValueMgr - Object that manages the data for all created RVals.
|
/// ValueMgr - Object that manages the data for all created RVals.
|
||||||
ValueManager ValMgr;
|
BasicValueFactory BasicVals;
|
||||||
|
|
||||||
/// SymMgr - Object that manages the symbol information.
|
/// SymMgr - Object that manages the symbol information.
|
||||||
SymbolManager SymMgr;
|
SymbolManager SymMgr;
|
||||||
|
@ -205,12 +205,12 @@ public:
|
||||||
VBFactory(alloc),
|
VBFactory(alloc),
|
||||||
CNEFactory(alloc),
|
CNEFactory(alloc),
|
||||||
CEFactory(alloc),
|
CEFactory(alloc),
|
||||||
ValMgr(Ctx, alloc),
|
BasicVals(Ctx, alloc),
|
||||||
Alloc(alloc) {}
|
Alloc(alloc) {}
|
||||||
|
|
||||||
ValueState* getInitialState();
|
ValueState* getInitialState();
|
||||||
|
|
||||||
ValueManager& getValueManager() { return ValMgr; }
|
BasicValueFactory& getBasicValueFactory() { return BasicVals; }
|
||||||
SymbolManager& getSymbolManager() { return SymMgr; }
|
SymbolManager& getSymbolManager() { return SymMgr; }
|
||||||
|
|
||||||
ValueState* RemoveDeadBindings(ValueState* St, Stmt* Loc,
|
ValueState* RemoveDeadBindings(ValueState* St, Stmt* Loc,
|
||||||
|
|
Loading…
Reference in New Issue