38static std::pair<NonLoc, nonloc::ConcreteInt>
41 const llvm::APSInt &ExtentVal = Extent.
getValue();
43 if (SymVal && SymVal->isExpression()) {
44 if (
const SymIntExpr *SIE = dyn_cast<SymIntExpr>(SymVal->getSymbol())) {
46 switch (SIE->getOpcode()) {
50 if ((ExtentVal %
Num) != 0)
51 return std::pair<NonLoc, nonloc::ConcreteInt>(Offset, Extent);
64 return std::pair<NonLoc, nonloc::ConcreteInt>(Offset, Extent);
69 return MaxV && MaxV->isNegative();
74 return T->isUnsignedIntegerType();
77std::pair<ProgramStateRef, ProgramStateRef>
82 std::tie(
Value, Threshold) =
96 return {
nullptr, State};
99 return {State,
nullptr};
104 return {
nullptr, State};
118 auto BelowThreshold =
123 return State->assume(*BelowThreshold);
125 return {
nullptr,
nullptr};
130 std::optional<NonLoc> Extent,
137 auto [PrecedesLowerBound, WithinLowerBound] =
140 if (PrecedesLowerBound) {
159 if (!WithinLowerBound) {
161 Res.IsCorruptedState =
true;
168 Res.MayUnderflow =
true;
170 if (!WithinLowerBound) {
180 if (WithinLowerBound)
181 State = WithinLowerBound;
192 auto [WithinUpperBound, ExceedsUpperBound] =
195 if (ExceedsUpperBound) {
197 Res.ExtentIfMayOverflow = Extent;
199 if (!WithinUpperBound) {
204 if (WithinUpperBound)
205 State = WithinUpperBound;
208 Res.InBoundsState = State;
static std::pair< NonLoc, nonloc::ConcreteInt > getSimplifiedOffsets(NonLoc Offset, nonloc::ConcreteInt Extent, SValBuilder &SVB)
static bool isNegative(SValBuilder &SVB, ProgramStateRef State, NonLoc Value)
static bool isUnsigned(SValBuilder &SVB, NonLoc Value)
A (possibly-)qualified type.
A record of the "type" of an APSInt, used for conversions.
llvm::APSInt convert(const llvm::APSInt &Value) const LLVM_READONLY
Convert and return a new APSInt with the given value, but this type's bit width and signedness.
ASTContext & getContext()
nonloc::ConcreteInt makeIntVal(const IntegerLiteral *integer)
virtual SVal evalBinOpNN(ProgramStateRef state, BinaryOperator::Opcode op, NonLoc lhs, NonLoc rhs, QualType resultTy)=0
Create a new value which represents a binary expression with two non- location operands.
QualType getConditionType() const
virtual const llvm::APSInt * getMaxValue(ProgramStateRef state, SVal val)=0
Tries to get the maximal possible (integer) value of a given SVal.
NonLoc makeZeroArrayIndex()
std::optional< T > getAs() const
Convert to the specified SVal type, returning std::nullopt if this SVal is not of the desired type.
Value representing integer constant.
APSIntPtr getValue() const
Represents symbolic expression that isn't a location.
std::pair< ProgramStateRef, ProgramStateRef > compareValueToThreshold(ProgramStateRef State, SValBuilder &SVB, NonLoc Value, NonLoc Threshold, bool CheckEquality=false)
CheckResult checkBounds(ProgramStateRef State, SValBuilder &SVB, NonLoc Offset, std::optional< NonLoc > Extent, CheckFlags Flags)
Checks the validity of accessing a memory region with extent Extent at offset Offset.
IntrusiveRefCntPtr< const ProgramState > ProgramStateRef
BinarySymExprImpl< const SymExpr *, APSIntPtr, SymExpr::Kind::SymIntExprKind > SymIntExpr
Represents a symbolic expression like 'x' + 3.
Top level wrappers for InstallAPI frontend operations.
const FunctionProtoType * T
unsigned OffsetObviouslyNonnegative