clang
3.9.0
|
#include <SimpleConstraintManager.h>
Public Member Functions | |
SimpleConstraintManager (SubEngine *subengine, SValBuilder &SB) | |
~SimpleConstraintManager () override | |
ProgramStateRef | assume (ProgramStateRef state, DefinedSVal Cond, bool Assumption) override |
ProgramStateRef | assume (ProgramStateRef state, NonLoc Cond, bool Assumption) |
ProgramStateRef | assumeWithinInclusiveRange (ProgramStateRef State, NonLoc Value, const llvm::APSInt &From, const llvm::APSInt &To, bool InRange) override |
ProgramStateRef | assumeSymRel (ProgramStateRef state, const SymExpr *LHS, BinaryOperator::Opcode op, const llvm::APSInt &Int) |
ProgramStateRef | assumeSymWithinInclusiveRange (ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &From, const llvm::APSInt &To, bool InRange) |
![]() | |
ConstraintManager () | |
virtual | ~ConstraintManager () |
ProgramStatePair | assumeDual (ProgramStateRef State, DefinedSVal Cond) |
Returns a pair of states (StTrue, StFalse) where the given condition is assumed to be true or false, respectively. More... | |
virtual ProgramStatePair | assumeWithinInclusiveRangeDual (ProgramStateRef State, NonLoc Value, const llvm::APSInt &From, const llvm::APSInt &To) |
virtual const llvm::APSInt * | getSymVal (ProgramStateRef state, SymbolRef sym) const |
If a symbol is perfectly constrained to a constant, attempt to return the concrete value. More... | |
virtual ProgramStateRef | removeDeadBindings (ProgramStateRef state, SymbolReaper &SymReaper)=0 |
virtual void | print (ProgramStateRef state, raw_ostream &Out, const char *nl, const char *sep)=0 |
virtual void | EndPath (ProgramStateRef state) |
ConditionTruthVal | isNull (ProgramStateRef State, SymbolRef Sym) |
Convenience method to query the state to see if a symbol is null or not null, or if neither assumption can be made. More... | |
Protected Member Functions | |
virtual ProgramStateRef | assumeSymNE (ProgramStateRef state, SymbolRef sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0 |
virtual ProgramStateRef | assumeSymEQ (ProgramStateRef state, SymbolRef sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0 |
virtual ProgramStateRef | assumeSymLT (ProgramStateRef state, SymbolRef sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0 |
virtual ProgramStateRef | assumeSymGT (ProgramStateRef state, SymbolRef sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0 |
virtual ProgramStateRef | assumeSymLE (ProgramStateRef state, SymbolRef sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0 |
virtual ProgramStateRef | assumeSymGE (ProgramStateRef state, SymbolRef sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0 |
virtual ProgramStateRef | assumeSymbolWithinInclusiveRange (ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &From, const llvm::APSInt &To, const llvm::APSInt &Adjustment)=0 |
virtual ProgramStateRef | assumeSymbolOutOfInclusiveRange (ProgramStateRef state, SymbolRef Sym, const llvm::APSInt &From, const llvm::APSInt &To, const llvm::APSInt &Adjustment)=0 |
BasicValueFactory & | getBasicVals () const |
SymbolManager & | getSymbolManager () const |
bool | canReasonAbout (SVal X) const override |
canReasonAbout - Not all ConstraintManagers can accurately reason about all SVal values. More... | |
ProgramStateRef | assumeAux (ProgramStateRef state, NonLoc Cond, bool Assumption) |
ProgramStateRef | assumeAuxForSymbol (ProgramStateRef State, SymbolRef Sym, bool Assumption) |
![]() | |
virtual ConditionTruthVal | checkNull (ProgramStateRef State, SymbolRef Sym) |
Returns whether or not a symbol is known to be null ("true"), known to be non-null ("false"), or may be either ("underconstrained"). More... | |
Additional Inherited Members | |
![]() | |
typedef std::pair < ProgramStateRef, ProgramStateRef > | ProgramStatePair |
![]() | |
bool | NotifyAssumeClients |
A flag to indicate that clients should be notified of assumptions. More... | |
Definition at line 24 of file SimpleConstraintManager.h.
|
inline |
Definition at line 28 of file SimpleConstraintManager.h.
|
override |
Definition at line 24 of file SimpleConstraintManager.cpp.
|
overridevirtual |
Implements clang::ento::ConstraintManager.
Definition at line 68 of file SimpleConstraintManager.cpp.
References clang::ASTContext::BoolTy, clang::ento::SVal::castAs(), clang::ento::SValBuilder::evalCast(), clang::ento::SVal::getAs(), clang::ento::SValBuilder::getContext(), and clang::ASTContext::VoidPtrTy.
Referenced by assumeAux().
ProgramStateRef clang::ento::SimpleConstraintManager::assume | ( | ProgramStateRef | state, |
NonLoc | Cond, | ||
bool | Assumption | ||
) |
Definition at line 87 of file SimpleConstraintManager.cpp.
References assumeAux(), clang::ento::ConstraintManager::NotifyAssumeClients, clang::ento::SubEngine::processAssume(), and clang::CodeGen::state.
|
protected |
Definition at line 114 of file SimpleConstraintManager.cpp.
References assume(), assumeAuxForSymbol(), assumeSymRel(), canReasonAbout(), clang::ento::SVal::castAs(), clang::ento::SVal::getAsSymExpr(), getBasicVals(), clang::ento::SymbolManager::getContext(), clang::ento::nonloc::LocAsInteger::getLoc(), clang::ASTContext::getPointerDiffType(), clang::ento::SVal::getSubKind(), clang::ento::nonloc::SymbolVal::getSymbol(), getSymbolManager(), clang::ento::SymbolManager::getSymSymExpr(), getValue(), clang::BinaryOperator::isComparisonOp(), clang::ento::nonloc::SymbolVal::isExpression(), clang::ento::Loc::isLocType(), clang::BinaryOperator::negateComparisonOp(), and clang::BinaryOperator::reverseComparisonOp().
Referenced by assume().
|
protected |
Definition at line 98 of file SimpleConstraintManager.cpp.
References assumeSymEQ(), assumeSymNE(), getBasicVals(), clang::ento::SymExpr::getType(), and clang::Type::isIntegralOrEnumerationType().
Referenced by assumeAux().
|
protectedpure virtual |
Referenced by assumeSymWithinInclusiveRange().
|
protectedpure virtual |
Referenced by assumeSymWithinInclusiveRange().
|
protectedpure virtual |
Referenced by assumeAuxForSymbol(), and assumeSymRel().
|
protectedpure virtual |
Referenced by assumeSymRel().
|
protectedpure virtual |
Referenced by assumeSymRel().
|
protectedpure virtual |
Referenced by assumeSymRel().
|
protectedpure virtual |
Referenced by assumeSymRel().
|
protectedpure virtual |
Referenced by assumeAuxForSymbol(), and assumeSymRel().
ProgramStateRef clang::ento::SimpleConstraintManager::assumeSymRel | ( | ProgramStateRef | state, |
const SymExpr * | LHS, | ||
BinaryOperator::Opcode | op, | ||
const llvm::APSInt & | Int | ||
) |
Definition at line 246 of file SimpleConstraintManager.cpp.
References assumeSymEQ(), assumeSymGE(), assumeSymGT(), assumeSymLE(), assumeSymLT(), assumeSymNE(), clang::ento::computeAdjustment(), clang::ento::APSIntType::convert(), clang::ento::BasicValueFactory::getAPSIntType(), getBasicVals(), clang::ento::APSIntType::getBitWidth(), clang::ento::SymExpr::getType(), clang::ento::APSIntType::getZeroValue(), clang::BinaryOperator::isComparisonOp(), clang::ento::APSIntType::isUnsigned(), and max().
Referenced by assumeAux().
ProgramStateRef clang::ento::SimpleConstraintManager::assumeSymWithinInclusiveRange | ( | ProgramStateRef | State, |
SymbolRef | Sym, | ||
const llvm::APSInt & | From, | ||
const llvm::APSInt & | To, | ||
bool | InRange | ||
) |
Definition at line 302 of file SimpleConstraintManager.cpp.
References assumeSymbolOutOfInclusiveRange(), assumeSymbolWithinInclusiveRange(), clang::ento::computeAdjustment(), clang::ento::APSIntType::convert(), clang::ento::BasicValueFactory::getAPSIntType(), getBasicVals(), clang::ento::APSIntType::getBitWidth(), clang::ento::SymExpr::getType(), clang::ento::APSIntType::getZeroValue(), clang::ento::APSIntType::isUnsigned(), and max().
Referenced by assumeWithinInclusiveRange().
|
overridevirtual |
Implements clang::ento::ConstraintManager.
Definition at line 193 of file SimpleConstraintManager.cpp.
References assumeSymWithinInclusiveRange(), canReasonAbout(), clang::ento::SVal::castAs(), clang::ento::SVal::getAsSymbol(), clang::ento::SVal::getAsSymExpr(), clang::ento::SVal::getSubKind(), getValue(), and State.
canReasonAbout - Not all ConstraintManagers can accurately reason about all SVal values.
This method returns true if the ConstraintManager can reasonably handle a given SVal value. This is typically queried by ExprEngine to determine if the value should be replaced with a conjured symbolic value in order to recover some precision.
Implements clang::ento::ConstraintManager.
Definition at line 26 of file SimpleConstraintManager.cpp.
References clang::ento::SVal::getAs(), clang::BinaryOperator::isComparisonOp(), and clang::ento::Loc::isLocType().
Referenced by assumeAux(), and assumeWithinInclusiveRange().
|
inlineprotected |
Definition at line 103 of file SimpleConstraintManager.h.
References clang::ento::SValBuilder::getBasicValueFactory().
Referenced by assumeAux(), assumeAuxForSymbol(), assumeSymRel(), and assumeSymWithinInclusiveRange().
|
inlineprotected |
Definition at line 104 of file SimpleConstraintManager.h.
References clang::ento::SValBuilder::getSymbolManager().
Referenced by assumeAux().