21 using namespace clang;
25 class SimpleSValBuilder :
public SValBuilder {
27 SVal dispatchCast(SVal val,
QualType castTy)
override;
28 SVal evalCastFromNonLoc(NonLoc val,
QualType castTy)
override;
29 SVal evalCastFromLoc(Loc val,
QualType castTy)
override;
32 SimpleSValBuilder(llvm::BumpPtrAllocator &alloc,
ASTContext &context,
33 ProgramStateManager &stateMgr)
34 : SValBuilder(alloc, context, stateMgr) {}
35 ~SimpleSValBuilder()
override {}
37 SVal evalMinus(NonLoc val)
override;
38 SVal evalComplement(NonLoc val)
override;
40 NonLoc lhs, NonLoc rhs,
QualType resultTy)
override;
42 Loc lhs, Loc rhs,
QualType resultTy)
override;
44 Loc lhs, NonLoc rhs,
QualType resultTy)
override;
55 const llvm::APSInt &RHS,
QualType resultTy);
62 return new SimpleSValBuilder(alloc, context, stateMgr);
85 if (castSize == LI->getNumBits())
87 return makeLocAsInteger(LI->getLoc(), castSize);
99 if (haveSameType(T, castTy))
103 return makeNonLoc(se, T, castTy);
114 return makeTruthVal(b, castTy);
123 BasicVals.getAPSIntType(castTy).apply(i);
126 return makeIntLocVal(i);
128 return makeIntVal(i);
151 case loc::MemRegionValKind: {
154 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(FTR->getDecl()))
162 return makeNonLoc(SymR->getSymbol(), BO_NE,
163 BasicVals.getZeroWithPtrWidth(), castTy);
169 case loc::GotoLabelKind:
171 return makeTruthVal(
true, castTy);
179 return makeLocAsInteger(val, BitWidth);
182 BasicVals.getAPSIntType(castTy).apply(i);
183 return makeIntVal(i);
196 SVal SimpleSValBuilder::evalMinus(
NonLoc val) {
198 case nonloc::ConcreteIntKind:
207 case nonloc::ConcreteIntKind:
218 SVal SimpleSValBuilder::MakeSymIntVal(
const SymExpr *LHS,
220 const llvm::APSInt &RHS,
222 bool isIdempotent =
false;
232 return makeIntVal(0, resultTy);
250 return makeIntVal(0, resultTy);
264 return makeIntVal(0, resultTy);
265 else if (RHS.isAllOnesValue())
272 else if (RHS.isAllOnesValue()) {
273 const llvm::APSInt &Result = BasicVals.Convert(resultTy, RHS);
287 const llvm::APSInt *ConvertedRHS = &RHS;
294 uint64_t ValWidth = RHS.getBitWidth();
297 if (ValWidth < TypeWidth) {
299 ConvertedRHS = &BasicVals.Convert(SymbolType, RHS);
300 }
else if (ValWidth == TypeWidth) {
305 ConvertedRHS = &BasicVals.Convert(SymbolType, RHS);
308 ConvertedRHS = &BasicVals.Convert(resultTy, RHS);
310 return makeNonLoc(LHS, op, *ConvertedRHS, resultTy);
316 SValBuilder &SVB = State->getStateManager().getSValBuilder();
318 SVB.evalBinOpNN(State, Rel, nonloc::SymbolVal(Sym),
319 nonloc::ConcreteInt(Bound), SVB.getConditionType());
320 if (
auto DV = Result.getAs<DefinedSVal>()) {
321 return !State->assume(*DV,
false);
333 SValBuilder &SVB = State->getStateManager().getSValBuilder();
334 BasicValueFactory &BV = SVB.getBasicValueFactory();
338 "This only works with signed integers!");
339 APSIntType AT = BV.getAPSIntType(T);
341 llvm::APSInt Max = AT.getMaxValue() / AT.getValue(4), Min = -Max;
349 assert(!AT.isUnsigned() &&
350 "This only works with signed integers!");
352 llvm::APSInt Max = AT.getMaxValue() / AT.getValue(4), Min = -Max;
353 return (I <= Max) && (I >= -Max);
356 static std::pair<SymbolRef, llvm::APSInt>
358 if (
const auto *SymInt = dyn_cast<SymIntExpr>(Sym))
360 return std::make_pair(SymInt->getLHS(),
361 (SymInt->getOpcode() == BO_Add) ?
363 (-SymInt->getRHS()));
366 return std::make_pair(Sym, BV.getValue(0, Sym->getType()));
376 SValBuilder &SVB = State->getStateManager().getSValBuilder();
377 BasicValueFactory &BV = SVB.getBasicValueFactory();
378 SymbolManager &SymMgr = SVB.getSymbolManager();
381 assert(SymTy == RSym->getType() &&
382 "Symbols are not of the same type!");
383 assert(APSIntType(LInt) == BV.getAPSIntType(SymTy) &&
384 "Integers are not of the same type as symbols!");
385 assert(APSIntType(RInt) == BV.getAPSIntType(SymTy) &&
386 "Integers are not of the same type as symbols!");
390 ResultTy = SVB.getConditionType();
394 llvm_unreachable(
"Operation not suitable for unchecked rearrangement!");
398 return SVB.evalBinOpNN(State, Op, nonloc::ConcreteInt(LInt),
399 nonloc::ConcreteInt(RInt), ResultTy)
404 llvm::APSInt ResultInt;
410 ResultSym = SymMgr.getSymSymExpr(RSym, BO_Sub, LSym, SymTy);
412 ResultInt = LInt - RInt;
414 ResultSym = SymMgr.getSymSymExpr(LSym, BO_Sub, RSym, SymTy);
416 ResultInt = RInt - LInt;
419 ResultSym = SymMgr.getSymSymExpr(LSym, Op, RSym, SymTy);
420 ResultInt = (Op == BO_Add) ? (LInt + RInt) : (LInt - RInt);
424 ResultInt = -ResultInt;
426 }
else if (ResultInt == 0) {
428 return nonloc::SymbolVal(ResultSym);
431 const llvm::APSInt &PersistentResultInt = BV.getValue(ResultInt);
432 return nonloc::SymbolVal(
433 SymMgr.getSymIntExpr(ResultSym, ResultOp, PersistentResultInt, ResultTy));
441 return Sym->getType() == Ty &&
450 ProgramStateManager &StateMgr = State->getStateManager();
451 SValBuilder &SVB = StateMgr.getSValBuilder();
457 StateMgr.getOwningEngine().getAnalysisManager().getAnalyzerOptions();
462 if(!Opts.ShouldAggressivelySimplifyBinaryOperation)
470 SingleTy = LSym->getType();
471 if (ResultTy != SVB.getConditionType())
476 if (LSym->getType() != SingleTy)
483 assert(!SingleTy.
isNull() &&
"We should have figured out the type by now!");
490 if (!RSym || RSym->getType() != SingleTy)
493 BasicValueFactory &BV = State->getBasicVals();
494 llvm::APSInt LInt, RInt;
507 NonLoc lhs, NonLoc rhs,
509 NonLoc InputLHS = lhs;
510 NonLoc InputRHS = rhs;
520 return makeTruthVal(
true, resultTy);
524 return makeTruthVal(
false, resultTy);
528 return makeIntVal(0, resultTy);
529 return evalCastFromNonLoc(makeIntVal(0,
false), resultTy);
532 return evalCastFromNonLoc(lhs, resultTy);
536 switch (lhs.getSubKind()) {
538 return makeSymExprValNN(op, lhs, rhs, resultTy);
539 case nonloc::PointerToMemberKind: {
540 assert(rhs.getSubKind() == nonloc::PointerToMemberKind &&
541 "Both SVals should have pointer-to-member-type");
544 auto LPTMD = LPTM.getPTMData(), RPTMD = RPTM.getPTMData();
547 return makeTruthVal(LPTMD == RPTMD, resultTy);
549 return makeTruthVal(LPTMD != RPTMD, resultTy);
554 case nonloc::LocAsIntegerKind: {
555 Loc lhsL = lhs.castAs<nonloc::LocAsInteger>().getLoc();
556 switch (rhs.getSubKind()) {
557 case nonloc::LocAsIntegerKind:
562 return evalBinOpLL(
state, op, lhsL,
563 rhs.castAs<nonloc::LocAsInteger>().getLoc(),
565 case nonloc::ConcreteIntKind: {
574 llvm::APSInt i = rhs.castAs<nonloc::ConcreteInt>().
getValue();
575 BasicVals.getAPSIntType(Context.
VoidPtrTy).apply(i);
576 return evalBinOpLL(
state, op, lhsL, makeLoc(i), resultTy);
581 return makeTruthVal(
false, resultTy);
583 return makeTruthVal(
true, resultTy);
586 return makeSymExprValNN(op, InputLHS, InputRHS, resultTy);
590 case nonloc::ConcreteIntKind: {
591 llvm::APSInt LHSValue = lhs.castAs<nonloc::ConcreteInt>().
getValue();
594 if (
const llvm::APSInt *KnownRHSValue = getKnownValue(
state, rhs)) {
595 llvm::APSInt RHSValue = *KnownRHSValue;
600 APSIntType CompareType =
std::max(APSIntType(LHSValue),
601 APSIntType(RHSValue));
602 CompareType.apply(LHSValue);
603 CompareType.apply(RHSValue);
605 APSIntType IntType = BasicVals.getAPSIntType(resultTy);
606 IntType.apply(LHSValue);
607 IntType.apply(RHSValue);
610 const llvm::APSInt *Result =
611 BasicVals.evalAPSInt(op, LHSValue, RHSValue);
613 return UndefinedVal();
615 return nonloc::ConcreteInt(*Result);
640 if (LHSValue.isAllOnesValue() && LHSValue.isSigned())
641 return evalCastFromNonLoc(lhs, resultTy);
646 return evalCastFromNonLoc(lhs, resultTy);
647 return makeSymExprValNN(op, InputLHS, InputRHS, resultTy);
649 return makeSymExprValNN(op, InputLHS, InputRHS, resultTy);
652 case nonloc::SymbolValKind: {
654 SymbolRef Sym = lhs.castAs<nonloc::SymbolVal>().getSymbol();
657 if (
const SymIntExpr *symIntExpr = dyn_cast<SymIntExpr>(Sym)) {
660 if (op == BO_EQ && rhs.isZeroConstant()) {
671 llvm_unreachable(
"Logical operators handled by branching logic.");
684 llvm_unreachable(
"'=' and ',' operators handled by ExprEngine.");
687 llvm_unreachable(
"Pointer arithmetic not handled here.");
695 resultTy == getConditionType());
696 assert(symIntExpr->getType()->isBooleanType() ||
697 getContext().hasSameUnqualifiedType(symIntExpr->getType(),
698 getConditionType()));
701 return makeNonLoc(symIntExpr->getLHS(), opc,
702 symIntExpr->getRHS(), resultTy);
707 if (
const llvm::APSInt *RHSValue = getKnownValue(
state, rhs)) {
720 APSIntType IntType = BasicVals.getAPSIntType(resultTy);
721 const llvm::APSInt &first = IntType.convert(symIntExpr->getRHS());
722 const llvm::APSInt &second = IntType.convert(*RHSValue);
724 const llvm::APSInt *newRHS;
726 newRHS = BasicVals.evalAPSInt(BO_Add, first, second);
728 newRHS = BasicVals.evalAPSInt(BO_Sub, first, second);
730 assert(newRHS &&
"Invalid operation despite common type!");
731 rhs = nonloc::ConcreteInt(*newRHS);
732 lhs = nonloc::SymbolVal(symIntExpr->getLHS());
739 return MakeSymIntVal(symIntExpr, op, *RHSValue, resultTy);
746 SVal simplifiedLhs = simplifySVal(
state, lhs);
747 if (simplifiedLhs != lhs)
748 if (
auto simplifiedLhsAsNonLoc = simplifiedLhs.getAs<NonLoc>()) {
749 lhs = *simplifiedLhsAsNonLoc;
754 if (
const llvm::APSInt *RHSValue = getKnownValue(
state, rhs))
755 return MakeSymIntVal(Sym, op, *RHSValue, resultTy);
761 return makeSymExprValNN(op, InputLHS, InputRHS, resultTy);
768 const FieldRegion *RightFR,
771 SimpleSValBuilder &SVB) {
779 if (LeftFR->getSuperRegion() != RightFR->getSuperRegion())
782 const FieldDecl *LeftFD = LeftFR->getDecl();
783 const FieldDecl *RightFD = RightFR->getDecl();
794 return SVB.makeTruthVal(
false, resultTy);
796 return SVB.makeTruthVal(
true, resultTy);
802 bool leftFirst = (op == BO_LT || op == BO_LE);
803 for (
const auto *I : RD->
fields()) {
805 return SVB.makeTruthVal(leftFirst, resultTy);
807 return SVB.makeTruthVal(!leftFirst, resultTy);
810 llvm_unreachable(
"Fields not found in parent record's definition");
831 llvm_unreachable(
"Unimplemented operation for two identical values");
833 return makeZeroVal(resultTy);
837 return makeTruthVal(
true, resultTy);
841 return makeTruthVal(
false, resultTy);
845 switch (lhs.getSubKind()) {
847 llvm_unreachable(
"Ordering not implemented for this Loc.");
849 case loc::GotoLabelKind:
851 if (rhs.isZeroConstant()) {
856 return evalCastFromLoc(lhs, resultTy);
860 return makeTruthVal(
false, resultTy);
864 return makeTruthVal(
true, resultTy);
874 case loc::ConcreteIntKind: {
877 if (
SymbolRef rSym = rhs.getAsLocSymbol()) {
883 const llvm::APSInt &lVal = lhs.castAs<loc::ConcreteInt>().
getValue();
885 return makeNonLoc(rSym, op, lVal, resultTy);
891 lhs.castAs<loc::ConcreteInt>().evalBinOp(BasicVals, op, *rInt);
893 return evalCastFromNonLoc(*Result, resultTy);
895 assert(!ResultVal.getAs<Loc>() &&
"Loc-Loc ops should not produce Locs");
903 assert(rhs.getAs<loc::MemRegionVal>() || rhs.getAs<loc::GotoLabel>());
904 if (lhs.isZeroConstant()) {
911 return makeTruthVal(
false, resultTy);
915 return makeTruthVal(
true, resultTy);
923 case loc::MemRegionValKind: {
927 if (
SymbolRef lSym = lhs.getAsLocSymbol(
true)) {
929 return MakeSymIntVal(lSym, op, rInt->getValue(), resultTy);
936 if (rInt->isZeroConstant()) {
938 return evalCastFromLoc(lhs, resultTy);
941 QualType boolType = getContext().BoolTy;
942 NonLoc l = evalCastFromLoc(lhs, boolType).castAs<NonLoc>();
943 NonLoc r = makeTruthVal(
false, boolType).castAs<NonLoc>();
944 return evalBinOpNN(
state, op, l, r, resultTy);
953 const MemRegion *LeftMR = lhs.getAsRegion();
954 assert(LeftMR &&
"MemRegionValKind SVal doesn't have a region!");
956 const MemRegion *RightMR = rhs.getAsRegion();
963 const MemRegion *LeftBase = LeftMR->getBaseRegion();
964 const MemRegion *RightBase = RightMR->getBaseRegion();
965 const MemSpaceRegion *LeftMS = LeftBase->getMemorySpace();
966 const MemSpaceRegion *RightMS = RightBase->getMemorySpace();
967 const MemSpaceRegion *UnknownMS = MemMgr.getUnknownRegion();
972 if (LeftMS != RightMS &&
973 ((LeftMS != UnknownMS && RightMS != UnknownMS) ||
974 (isa<StackSpaceRegion>(LeftMS) || isa<StackSpaceRegion>(RightMS)))) {
979 return makeTruthVal(
false, resultTy);
981 return makeTruthVal(
true, resultTy);
995 if (LeftBase != RightBase &&
996 ((!isa<SymbolicRegion>(LeftBase) && !isa<SymbolicRegion>(RightBase)) ||
997 (isa<HeapSpaceRegion>(LeftMS) || isa<HeapSpaceRegion>(RightMS))) ){
1000 return UnknownVal();
1002 return makeTruthVal(
false, resultTy);
1004 return makeTruthVal(
true, resultTy);
1009 const ElementRegion *RightER = dyn_cast<ElementRegion>(RightMR);
1010 const ElementRegion *LeftER = dyn_cast<ElementRegion>(LeftMR);
1011 if (RightER && LeftER) {
1016 if (LeftER->getSuperRegion() == RightER->getSuperRegion() &&
1017 LeftER->getElementType() == RightER->getElementType()) {
1020 SVal LeftIndexVal = LeftER->getIndex();
1023 return UnknownVal();
1024 LeftIndexVal = evalCastFromNonLoc(*LeftIndex, ArrayIndexTy);
1025 LeftIndex = LeftIndexVal.getAs<NonLoc>();
1027 return UnknownVal();
1030 SVal RightIndexVal = RightER->getIndex();
1033 return UnknownVal();
1034 RightIndexVal = evalCastFromNonLoc(*RightIndex, ArrayIndexTy);
1035 RightIndex = RightIndexVal.getAs<NonLoc>();
1037 return UnknownVal();
1041 return evalBinOpNN(
state, op, *LeftIndex, *RightIndex, resultTy);
1046 const FieldRegion *RightFR = dyn_cast<FieldRegion>(RightMR);
1047 const FieldRegion *LeftFR = dyn_cast<FieldRegion>(LeftMR);
1048 if (RightFR && LeftFR) {
1056 RegionOffset LeftOffset = LeftMR->getAsOffset();
1057 RegionOffset RightOffset = RightMR->getAsOffset();
1059 if (LeftOffset.getRegion() !=
nullptr &&
1060 LeftOffset.getRegion() == RightOffset.getRegion() &&
1061 !LeftOffset.hasSymbolicOffset() && !RightOffset.hasSymbolicOffset()) {
1062 int64_t left = LeftOffset.getOffset();
1063 int64_t right = RightOffset.getOffset();
1067 return UnknownVal();
1069 return makeTruthVal(left < right, resultTy);
1071 return makeTruthVal(left > right, resultTy);
1073 return makeTruthVal(left <= right, resultTy);
1075 return makeTruthVal(left >= right, resultTy);
1077 return makeTruthVal(left == right, resultTy);
1079 return makeTruthVal(left != right, resultTy);
1085 SymbolRef LHSSym = lhs.getAsLocSymbol();
1086 SymbolRef RHSSym = rhs.getAsLocSymbol();
1087 if (LHSSym && RHSSym)
1088 return makeNonLoc(LHSSym, op, RHSSym, resultTy);
1091 return UnknownVal();
1098 Loc lhs, NonLoc rhs,
QualType resultTy) {
1099 if (op >= BO_PtrMemD && op <= BO_PtrMemI) {
1101 if (PTMSV->isNullMemberPointer())
1102 return UndefinedVal();
1106 for (
const auto &I : *PTMSV)
1107 Result = StateMgr.getStoreManager().evalDerivedToBase(
1108 Result, I->getType(),I->isVirtual());
1109 return state->getLValue(FD, Result);
1117 "arguments to comparison ops must be of the same type");
1120 if (rhs.isZeroConstant())
1124 if (lhs.isZeroConstant())
1132 const llvm::APSInt &leftI = lhsInt->getValue();
1133 assert(leftI.isUnsigned());
1134 llvm::APSInt rightI(rhsInt->getValue(),
true);
1138 rightI = rightI.extOrTrunc(leftI.getBitWidth());
1141 llvm::APSInt Multiplicand(rightI.getBitWidth(),
true);
1143 Multiplicand = getContext().getTypeSizeInChars(pointeeType).getQuantity();
1144 rightI *= Multiplicand;
1149 rightI = leftI + rightI;
1152 rightI = leftI - rightI;
1155 llvm_unreachable(
"Invalid pointer arithmetic operation");
1157 return loc::ConcreteInt(getBasicValueFactory().
getValue(rightI));
1162 if (
const MemRegion *region = lhs.getAsRegion()) {
1163 rhs = convertToArrayIndex(rhs).castAs<NonLoc>();
1164 SVal index = UnknownVal();
1165 const SubRegion *superR =
nullptr;
1170 if (
const ElementRegion *elemReg = dyn_cast<ElementRegion>(region)) {
1171 assert(op == BO_Add || op == BO_Sub);
1172 index = evalBinOpNN(
state, op, elemReg->getIndex(), rhs,
1173 getArrayIndexType());
1174 superR = cast<SubRegion>(elemReg->getSuperRegion());
1175 elementType = elemReg->getElementType();
1177 else if (isa<SubRegion>(region)) {
1178 assert(op == BO_Add || op == BO_Sub);
1179 index = (op == BO_Add) ? rhs : evalMinus(rhs);
1180 superR = cast<SubRegion>(region);
1193 elementType = getContext().CharTy;
1196 return loc::MemRegionVal(MemMgr.getElementRegion(elementType, *indexV,
1197 superR, getContext()));
1200 return UnknownVal();
1205 V = simplifySVal(
state, V);
1206 if (V.isUnknownOrUndef())
1210 return &X->getValue();
1213 return &X->getValue();
1216 return state->getConstraintManager().getSymVal(
state, Sym);
1227 class Simplifier :
public FullSValVisitor<Simplifier, SVal> {
1235 llvm::DenseMap<SymbolRef, SVal> Cached;
1237 static bool isUnchanged(
SymbolRef Sym, SVal Val) {
1238 return Sym == Val.getAsSymbol();
1247 return cache(Sym, SVB.makeSymbolVal(Sym));
1252 :
State(State), SVB(State->getStateManager().getSValBuilder()) {}
1254 SVal VisitSymbolData(
const SymbolData *S) {
1256 if (
const llvm::APSInt *I =
1257 SVB.getKnownValue(State, SVB.makeSymbolVal(S)))
1258 return Loc::isLocType(S->getType()) ? (SVal)SVB.makeIntLocVal(*I)
1259 : (SVal)SVB.makeIntVal(*I);
1260 return SVB.makeSymbolVal(S);
1266 SVal VisitSymIntExpr(
const SymIntExpr *S) {
1267 auto I = Cached.find(S);
1268 if (I != Cached.end())
1271 SVal LHS = Visit(S->getLHS());
1272 if (isUnchanged(S->getLHS(), LHS))
1285 if (
SymbolRef Sym = LHS.getAsSymbol()) {
1287 LHS = SVB.makeLoc(Sym);
1289 RHS = SVB.makeIntLocVal(S->getRHS());
1291 RHS = SVB.makeIntVal(S->getRHS());
1295 S, SVB.evalBinOp(State, S->getOpcode(), LHS, RHS, S->
getType()));
1298 SVal VisitSymSymExpr(
const SymSymExpr *S) {
1299 auto I = Cached.find(S);
1300 if (I != Cached.end())
1311 SVal LHS = Visit(S->getLHS());
1312 SVal RHS = Visit(S->getRHS());
1313 if (isUnchanged(S->getLHS(), LHS) && isUnchanged(S->getRHS(), RHS))
1317 S, SVB.evalBinOp(State, S->getOpcode(), LHS, RHS, S->getType()));
1320 SVal VisitSymExpr(
SymbolRef S) {
return nonloc::SymbolVal(S); }
1322 SVal VisitMemRegion(
const MemRegion *R) {
return loc::MemRegionVal(R); }
1324 SVal VisitNonLocSymbolVal(nonloc::SymbolVal V) {
1327 return Visit(V.getSymbol());
1330 SVal VisitSVal(SVal V) {
return V; }
1334 static bool isReentering =
false;
1338 isReentering =
true;
1339 SVal SimplifiedV = Simplifier(
State).Visit(V);
1340 isReentering =
false;
Represents a function declaration or definition.
if(T->getSizeExpr()) TRY_TO(TraverseStmt(T -> getSizeExpr()))
A (possibly-)qualified type.
MemRegion - The root abstract class for all memory regions.
const SymExpr * SymbolRef
SValBuilder * createSimpleSValBuilder(llvm::BumpPtrAllocator &alloc, ASTContext &context, ProgramStateManager &stateMgr)
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
static bool isWithinConstantOverflowBounds(SymbolRef Sym, ProgramStateRef State)
IntrusiveRefCntPtr< const ProgramState > ProgramStateRef
const RecordDecl * getParent() const
Returns the parent of this field declaration, which is the struct in which this field is defined...
Value representing integer constant.
bool isAdditiveOp() const
Represents a struct/union/class.
const SymbolicRegion * getSymbolicBase() const
If this is a symbolic region, returns the region.
static NonLoc doRearrangeUnchecked(ProgramStateRef State, BinaryOperator::Opcode Op, SymbolRef LSym, llvm::APSInt LInt, SymbolRef RSym, llvm::APSInt RInt)
static Opcode reverseComparisonOp(Opcode Opc)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
static bool isInRelation(BinaryOperator::Opcode Rel, SymbolRef Sym, llvm::APSInt Bound, ProgramStateRef State)
Value representing pointer-to-member.
field_range fields() const
Represents a member of a struct/union/class.
bool isReferenceType() const
i32 captured_struct **param SharedsTy A type which contains references the shared variables *param Shareds Context with the list of shared variables from the p *TaskFunction *param Data Additional data for task generation like final * state
const SymExpr * getAsSymbolicExpression() const
getAsSymbolicExpression - If this Sval wraps a symbolic expression then return that expression...
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
static bool isLocType(QualType T)
static bool shouldRearrange(ProgramStateRef State, BinaryOperator::Opcode Op, SymbolRef Sym, llvm::APSInt Int, QualType Ty)
virtual QualType getType() const =0
static std::pair< SymbolRef, llvm::APSInt > decomposeSymbol(SymbolRef Sym, BasicValueFactory &BV)
static Opcode negateComparisonOp(Opcode Opc)
unsigned getSubKind() const
SymbolicRegion - A special, "non-concrete" region.
static SVal getValue(SVal val, SValBuilder &svalBuilder)
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Optional< T > getAs() const
Convert to the specified SVal type, returning None if this SVal is not of the desired type...
bool isComparisonOp() const
FunctionCodeRegion - A region that represents code texts of function.
SVal - This represents a symbolic expression, which can be either an L-value or an R-value...
bool isSignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is signed or an enumeration types whose underlying ty...
bool isAnyPointerType() const
Dataflow Directional Tag Classes.
bool isBooleanType() const
Represents symbolic expression that isn't a location.
unsigned getIntWidth(QualType T) const
T castAs() const
Convert to the specified SVal type, asserting that this SVal is of the desired type.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
static Optional< NonLoc > tryRearrange(ProgramStateRef State, BinaryOperator::Opcode Op, NonLoc Lhs, NonLoc Rhs, QualType ResultTy)
__DEVICE__ int max(int __a, int __b)
static SVal evalBinOpFieldRegionFieldRegion(const FieldRegion *LeftFR, const FieldRegion *RightFR, BinaryOperator::Opcode op, QualType resultTy, SimpleSValBuilder &SVB)