28 if (SymVal && SymVal->isExpression()) {
29 const SymExpr *SE = SymVal->getSymbol();
31 if (
const SymIntExpr *SIE = dyn_cast<SymIntExpr>(SE)) {
32 switch (SIE->getOpcode()) {
52 if (
const SymSymExpr *SSE = dyn_cast<SymSymExpr>(SE)) {
73 SValBuilder &SVB = state->getStateManager().getSValBuilder();
76 if (
const TypedRegion *TR = dyn_cast_or_null<TypedRegion>(MR))
77 T = TR->getLocationType();
90 state =
assumeAux(state, cond, assumption);
107 const llvm::APSInt &zero = BVF.getValue(0, T);
128 llvm_unreachable(
"'Assume' not implemented for this NonLoc");
140 }
else if (
const SymIntExpr *SE = dyn_cast<SymIntExpr>(sym)) {
148 return assumeSymRel(state, SE->getLHS(), op, SE->getRHS());
151 }
else if (
const SymSymExpr *SSE = dyn_cast<SymSymExpr>(sym)) {
167 SSE->getLHS(), DiffTy);
169 const llvm::APSInt &Zero =
getBasicVals().getValue(0, DiffTy);
183 bool isFeasible = b ? Assumption : !Assumption;
184 return isFeasible ? state :
nullptr;
195 if (
const SymIntExpr *SE = dyn_cast<SymIntExpr>(Sym)) {
205 Adjustment = -Adjustment;
213 const llvm::APSInt& Int) {
215 "Non-comparison ops should be rewritten as comparisons to zero.");
229 llvm::APSInt Adjustment = WraparoundType.
getZeroValue();
234 llvm::APSInt ConvertedInt = ComparisonType.
convert(Int);
239 Adjustment.setIsSigned(
false);
243 llvm_unreachable(
"invalid operation not caught by assertion above");
246 return assumeSymEQ(state, Sym, ConvertedInt, Adjustment);
249 return assumeSymNE(state, Sym, ConvertedInt, Adjustment);
252 return assumeSymGT(state, Sym, ConvertedInt, Adjustment);
255 return assumeSymGE(state, Sym, ConvertedInt, Adjustment);
258 return assumeSymLT(state, Sym, ConvertedInt, Adjustment);
261 return assumeSymLE(state, Sym, ConvertedInt, Adjustment);
const SymExpr * getAsSymExpr() const
MemRegion - The root abstract class for all memory regions.
virtual ProgramStateRef assumeSymNE(ProgramStateRef state, SymbolRef sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
SVal evalCast(SVal val, QualType castTy, QualType originalType)
Value representing integer constant.
Symbolic value. These values used to capture symbolic execution of the program.
ASTContext & getContext()
bool isComparisonOp() const
static Opcode reverseComparisonOp(Opcode Opc)
virtual ProgramStateRef assumeSymGT(ProgramStateRef state, SymbolRef sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
~SimpleConstraintManager() override
static bool isLocType(QualType T)
uint32_t getBitWidth() const
A record of the "type" of an APSInt, used for conversions.
virtual ProgramStateRef assumeSymGE(ProgramStateRef state, SymbolRef sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
Represents a symbolic expression like 'x' + 3.
virtual ProgramStateRef assumeSymEQ(ProgramStateRef state, SymbolRef sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
llvm::APSInt getZeroValue() const LLVM_READONLY
Returns an all-zero value for this type.
virtual QualType getType() const =0
static Opcode negateComparisonOp(Opcode Opc)
Optional< T > getAs() const
Convert to the specified SVal type, returning None if this SVal is not of the desired type...
virtual ProgramStateRef assumeSymLE(ProgramStateRef state, SymbolRef sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
virtual ProgramStateRef processAssume(ProgramStateRef state, SVal cond, bool assumption)=0
SymbolManager & getSymbolManager() const
static SVal getValue(SVal val, SValBuilder &svalBuilder)
ProgramStateRef assumeSymRel(ProgramStateRef state, const SymExpr *LHS, BinaryOperator::Opcode op, const llvm::APSInt &Int)
const SymSymExpr * getSymSymExpr(const SymExpr *lhs, BinaryOperator::Opcode op, const SymExpr *rhs, QualType t)
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
ProgramStateRef assumeAux(ProgramStateRef state, NonLoc Cond, bool Assumption)
ASTContext & getContext()
ProgramStateRef assume(ProgramStateRef state, DefinedSVal Cond, bool Assumption) override
SymbolRef getSymbol() const
llvm::APSInt convert(const llvm::APSInt &Value) const LLVM_READONLY
unsigned getSubKind() const
ProgramStateRef assumeAuxForSymbol(ProgramStateRef State, SymbolRef Sym, bool Assumption)
bool isExpression() const
Represents symbolic expression.
QualType getPointerDiffType() const
Return the unique type for "ptrdiff_t" (C99 7.17) defined in <stddef.h>. Pointer - pointer requires t...
static void computeAdjustment(SymbolRef &Sym, llvm::APSInt &Adjustment)
bool canReasonAbout(SVal X) const override
virtual ProgramStateRef assumeSymLT(ProgramStateRef state, SymbolRef sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
APSIntType getAPSIntType(QualType T) const
Returns the type of the APSInt used to store values of the given QualType.
BasicValueFactory & getBasicVals() const
T castAs() const
Convert to the specified SVal type, asserting that this SVal is of the desired type.
Represents a symbolic expression like 'x' + 'y'.
TypedRegion - An abstract class representing regions that are typed.