13#ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_CONSTRAINTMANAGER_H
14#define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_CONSTRAINTMANAGER_H
20#include "llvm/Support/SaveAndRestore.h"
34class ProgramStateManager;
39 std::optional<bool> Val;
90 const llvm::APSInt &From,
91 const llvm::APSInt &To,
bool InBound);
99 const llvm::APSInt &From,
100 const llvm::APSInt &To);
135 const char *NL,
unsigned int Space,
136 bool IsDot)
const = 0;
152 void pop() { Aux.pop_back(); }
154 return llvm::is_contained(Aux, S);
167 const llvm::APSInt &From,
168 const llvm::APSInt &To,
182 template <
typename AssumeFunction>
184 AssumeFunction &Assume);
187std::unique_ptr<ConstraintManager>
191std::unique_ptr<ConstraintManager>
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
bool isUnderconstrained() const
Return true if the constrained is underconstrained and we do not know if the constraint is true of va...
ConditionTruthVal()=default
Construct a ConstraintVal indicating the constraint is underconstrained.
bool isConstrainedFalse() const
Return true if the constraint is perfectly constrained to 'false'.
bool isConstrained() const
Return true if the constrained is perfectly constrained.
ConditionTruthVal(bool constraint)
Construct a ConditionTruthVal indicating the constraint is constrained to either true or false,...
bool isConstrainedTrue() const
Return true if the constraint is perfectly constrained to 'true'.
A helper class to simulate the call stack of nested assume calls.
bool contains(const ProgramState *S) const
void push(const ProgramState *S)
virtual ProgramStateRef assumeInclusiveRangeInternal(ProgramStateRef State, NonLoc Value, const llvm::APSInt &From, const llvm::APSInt &To, bool InBound)=0
virtual const llvm::APSInt * getSymMaxVal(ProgramStateRef state, SymbolRef sym) const
Attempt to return the minimal possible value for a given symbol.
ProgramStateRef assumeInclusiveRange(ProgramStateRef State, NonLoc Value, const llvm::APSInt &From, const llvm::APSInt &To, bool InBound)
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.
virtual void printValue(raw_ostream &Out, ProgramStateRef State, SymbolRef Sym)
virtual bool canReasonAbout(SVal X) const =0
canReasonAbout - Not all ConstraintManagers can accurately reason about all SVal values.
ProgramStatePair assumeDual(ProgramStateRef State, DefinedSVal Cond)
Returns a pair of states (StTrue, StFalse) where the given condition is assumed to be true or false,...
ConstraintManager()=default
virtual ~ConstraintManager()
virtual void printJson(raw_ostream &Out, ProgramStateRef State, const char *NL, unsigned int Space, bool IsDot) const =0
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 assumptio...
virtual ProgramStateRef removeDeadBindings(ProgramStateRef state, SymbolReaper &SymReaper)=0
Scan all symbols referenced by the constraints.
AssumeStackTy AssumeStack
virtual const llvm::APSInt * getSymMinVal(ProgramStateRef state, SymbolRef sym) const
Attempt to return the minimal possible value for a given symbol.
ProgramStatePair assumeInclusiveRangeDual(ProgramStateRef State, NonLoc Value, const llvm::APSInt &From, const llvm::APSInt &To)
Returns a pair of states (StInRange, StOutOfRange) where the given value is assumed to be in the rang...
std::pair< ProgramStateRef, ProgramStateRef > ProgramStatePair
ProgramStateRef assume(ProgramStateRef state, DefinedSVal Cond, bool Assumption)
ProgramStatePair assumeDualImpl(ProgramStateRef &State, AssumeFunction &Assume)
virtual ProgramStateRef assumeInternal(ProgramStateRef state, DefinedSVal Cond, bool Assumption)=0
virtual bool haveEqualConstraints(ProgramStateRef S1, ProgramStateRef S2) const =0
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"),...
ProgramState - This class encapsulates:
SVal - This represents a symbolic expression, which can be either an L-value or an R-value.
A class responsible for cleaning up unused symbols.
std::unique_ptr< ConstraintManager > CreateZ3ConstraintManager(ProgramStateManager &statemgr, ExprEngine *exprengine)
std::unique_ptr< ConstraintManager > CreateRangeConstraintManager(ProgramStateManager &statemgr, ExprEngine *exprengine)
The JSON file list parser is used to communicate input to InstallAPI.
Diagnostic wrappers for TextAPI types for error reporting.