clang
7.0.0
|
#include "clang/StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h"
Public Member Functions | |
SMTConstraintManager (clang::ento::SubEngine *SE, clang::ento::SValBuilder &SB, SMTSolverRef &S) | |
virtual | ~SMTConstraintManager ()=default |
ProgramStateRef | assumeSym (ProgramStateRef state, SymbolRef Sym, bool Assumption) override |
Given a symbolic expression that can be reasoned about, assume that it is true/false and generate the new program state. More... | |
ProgramStateRef | assumeSymInclusiveRange (ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &From, const llvm::APSInt &To, bool InRange) override |
Given a symbolic expression within the range [From, To], assume that it is true/false and generate the new program state. More... | |
ProgramStateRef | assumeSymUnsupported (ProgramStateRef State, SymbolRef Sym, bool Assumption) override |
Given a symbolic expression that cannot be reasoned about, assume that it is zero/nonzero and add it directly to the solver state. More... | |
ConditionTruthVal | checkNull (ProgramStateRef State, SymbolRef Sym) override |
Returns whether or not a symbol is known to be null ("true"), known to be non-null ("false"), or may be either ("underconstrained"). More... | |
const llvm::APSInt * | getSymVal (ProgramStateRef State, SymbolRef Sym) const override |
If a symbol is perfectly constrained to a constant, attempt to return the concrete value. More... | |
LLVM_DUMP_METHOD void | dump () const |
Dumps SMT formula. More... | |
![]() | |
SimpleConstraintManager (SubEngine *subengine, SValBuilder &SB) | |
~SimpleConstraintManager () override | |
ProgramStateRef | assume (ProgramStateRef State, DefinedSVal Cond, bool Assumption) override |
Ensures that the DefinedSVal conditional is expressed as a NonLoc by creating boolean casts to handle Loc's. More... | |
ProgramStateRef | assumeInclusiveRange (ProgramStateRef State, NonLoc Value, const llvm::APSInt &From, const llvm::APSInt &To, bool InRange) override |
![]() | |
ConstraintManager ()=default | |
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 | assumeInclusiveRangeDual (ProgramStateRef State, NonLoc Value, const llvm::APSInt &From, const llvm::APSInt &To) |
virtual ProgramStateRef | removeDeadBindings (ProgramStateRef state, SymbolReaper &SymReaper)=0 |
Scan all symbols referenced by the constraints. More... | |
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 | assumeExpr (ProgramStateRef State, SymbolRef Sym, const SMTExprRef &Exp)=0 |
virtual void | addStateConstraints (ProgramStateRef State) const =0 |
Given a program state, construct the logical conjunction and add it to the solver. More... | |
ConditionTruthVal | checkModel (ProgramStateRef State, const SMTExprRef &Exp) const |
![]() | |
SValBuilder & | getSValBuilder () const |
BasicValueFactory & | getBasicVals () const |
SymbolManager & | getSymbolManager () const |
![]() | |
virtual bool | canReasonAbout (SVal X) const =0 |
canReasonAbout - Not all ConstraintManagers can accurately reason about all SVal values. More... | |
Additional Inherited Members | |
![]() | |
using | ProgramStatePair = std::pair< ProgramStateRef, ProgramStateRef > |
![]() | |
bool | NotifyAssumeClients = true |
A flag to indicate that clients should be notified of assumptions. More... | |
Definition at line 24 of file SMTConstraintManager.h.
|
inline |
Definition at line 28 of file SMTConstraintManager.h.
|
virtualdefault |
|
protectedpure virtual |
Given a program state, construct the logical conjunction and add it to the solver.
Referenced by checkModel(), checkNull(), dump(), and getSymVal().
|
protectedpure virtual |
Referenced by assumeSym(), assumeSymInclusiveRange(), and dump().
|
overridevirtual |
Given a symbolic expression that can be reasoned about, assume that it is true/false and generate the new program state.
Implements clang::ento::SimpleConstraintManager.
Definition at line 18 of file SMTConstraintManager.cpp.
References assumeExpr(), clang::ento::SimpleConstraintManager::getBasicVals(), clang::ento::BasicValueFactory::getContext(), and clang::Type::isBooleanType().
|
overridevirtual |
Given a symbolic expression within the range [From, To], assume that it is true/false and generate the new program state.
This function is used to handle case ranges produced by a language extension for switch case statements.
Implements clang::ento::SimpleConstraintManager.
Definition at line 36 of file SMTConstraintManager.cpp.
References assumeExpr(), clang::ento::SimpleConstraintManager::getBasicVals(), and clang::ento::BasicValueFactory::getContext().
|
overridevirtual |
Given a symbolic expression that cannot be reasoned about, assume that it is zero/nonzero and add it directly to the solver state.
Implements clang::ento::SimpleConstraintManager.
Definition at line 45 of file SMTConstraintManager.cpp.
References State.
|
protected |
Definition at line 175 of file SMTConstraintManager.cpp.
References addStateConstraints().
Referenced by dump().
|
overridevirtual |
Returns whether or not a symbol is known to be null ("true"), known to be non-null ("false"), or may be either ("underconstrained").
Reimplemented from clang::ento::ConstraintManager.
Definition at line 51 of file SMTConstraintManager.cpp.
References addStateConstraints(), clang::ento::SimpleConstraintManager::getBasicVals(), clang::ento::BasicValueFactory::getContext(), clang::ento::ConditionTruthVal::isConstrainedFalse(), and clang::ento::ConditionTruthVal::isConstrainedTrue().
|
inline |
Dumps SMT formula.
Definition at line 58 of file SMTConstraintManager.h.
References addStateConstraints(), assumeExpr(), and checkModel().
|
overridevirtual |
If a symbol is perfectly constrained to a constant, attempt to return the concrete value.
Note that a ConstraintManager is not obligated to return a concretized value for a symbol, even if it is perfectly constrained.
Reimplemented from clang::ento::ConstraintManager.
Definition at line 87 of file SMTConstraintManager.cpp.
References addStateConstraints(), clang::ento::SMTSolver::castAPSInt(), clang::ento::BasicValueFactory::Convert(), clang::ento::BasicValueFactory::evalAPSInt(), clang::ento::SimpleConstraintManager::getBasicVals(), clang::ento::BasicValueFactory::getContext(), clang::ento::SymExpr::getType(), clang::ASTContext::getTypeSize(), clang::Type::isBooleanType(), clang::ento::ConditionTruthVal::isConstrainedTrue(), clang::Type::isRealFloatingType(), clang::Type::isSignedIntegerOrEnumerationType(), and clang::Type::isVoidType().