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 % constant) != 0)
51 return std::pair<NonLoc, nonloc::ConcreteInt>(offset, extent);
55 svalBuilder.
makeIntVal(extentVal / constant), svalBuilder);
59 svalBuilder.
makeIntVal(extentVal - constant), svalBuilder);
66 return std::pair<NonLoc, nonloc::ConcreteInt>(offset, extent);
71 return MaxV && MaxV->isNegative();
76 return T->isUnsignedIntegerType();
86static std::pair<ProgramStateRef, ProgramStateRef>
90 std::tie(
Value, Threshold) =
104 return {
nullptr, State};
107 return {State,
nullptr};
112 return {
nullptr, State};
126 auto BelowThreshold =
131 return State->assume(*BelowThreshold);
133 return {
nullptr,
nullptr};
138 std::optional<NonLoc> Extent,
145 auto [PrecedesLowerBound, WithinLowerBound] =
148 if (PrecedesLowerBound) {
167 if (!WithinLowerBound) {
169 Res.IsCorruptedState =
true;
176 Res.MayUnderflow =
true;
178 if (!WithinLowerBound) {
188 if (WithinLowerBound)
189 State = WithinLowerBound;
200 auto [WithinUpperBound, ExceedsUpperBound] =
203 if (ExceedsUpperBound) {
205 Res.ExtentIfMayOverflow = Extent;
207 if (!WithinUpperBound) {
212 auto [EqualsToThreshold, NotEqualToThreshold] =
215 if (EqualsToThreshold && !NotEqualToThreshold) {
216 Res.ExtentIfMayOverflow = std::nullopt;
217 Res.InBoundsState = EqualsToThreshold;
223 if (WithinUpperBound)
224 State = WithinUpperBound;
227 Res.InBoundsState = State;
static std::pair< ProgramStateRef, ProgramStateRef > compareValueToThreshold(ProgramStateRef State, NonLoc Value, NonLoc Threshold, SValBuilder &SVB, bool CheckEquality=false)
static bool isNegative(SValBuilder &SVB, ProgramStateRef State, NonLoc Value)
static bool isUnsigned(SValBuilder &SVB, NonLoc Value)
static std::pair< NonLoc, nonloc::ConcreteInt > getSimplifiedOffsets(NonLoc offset, nonloc::ConcreteInt extent, SValBuilder &svalBuilder)
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.
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.
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T
unsigned AcceptPastTheEnd
unsigned OffsetObviouslyNonnegative