Home
last modified time | relevance | path

Searched refs:SVal (Results 1 – 25 of 138) sorted by relevance

123456

/src/contrib/llvm-project/clang/include/clang/StaticAnalyzer/Core/PathSensitive/
H A DStore.h74 virtual SVal getBinding(Store store, Loc loc, QualType T = QualType()) = 0;
86 virtual std::optional<SVal> getDefaultBinding(Store store,
97 std::optional<SVal> getDefaultBinding(nonloc::LazyCompoundVal lcv) { in getDefaultBinding()
108 virtual StoreRef Bind(Store store, Loc loc, SVal val) = 0;
114 SVal V) = 0;
144 virtual SVal getLValueIvar(const ObjCIvarDecl *decl, SVal base);
146 virtual SVal getLValueField(const FieldDecl *D, SVal Base) { in getLValueField()
150 virtual SVal getLValueElement(QualType elementType, NonLoc offset, SVal Base);
154 virtual SVal ArrayToPointer(Loc Array, QualType ElementTy) = 0;
158 SVal evalDerivedToBase(SVal Derived, const CastExpr *Cast);
[all …]
H A DSVals.h55 class SVal {
70 explicit SVal(SValKind Kind, const void *Data = nullptr)
78 explicit SVal() = default;
99 bool operator==(SVal R) const { return Kind == R.Kind && Data == R.Data; }
100 bool operator!=(SVal R) const { return !(*this == R); }
174 inline raw_ostream &operator<<(raw_ostream &os, clang::ento::SVal V) {
182 inline constexpr auto Id##Kind = SVal::SValKind::NonLoc##Id##Kind;
189 inline constexpr auto Id##Kind = SVal::SValKind::Loc##Id##Kind;
193 class UndefinedVal : public SVal {
195 UndefinedVal() : SVal(UndefinedValKind) {} in UndefinedVal()
[all …]
H A DSValBuilder.h84 SVal evalCast(SVal V, QualType CastTy, QualType OriginalTy);
87 SVal evalIntegralCast(ProgramStateRef state, SVal val, QualType castTy,
90 SVal evalMinus(NonLoc val);
91 SVal evalComplement(NonLoc val);
95 virtual SVal evalBinOpNN(ProgramStateRef state, BinaryOperator::Opcode op,
100 virtual SVal evalBinOpLL(ProgramStateRef state, BinaryOperator::Opcode op,
106 virtual SVal evalBinOpLN(ProgramStateRef state, BinaryOperator::Opcode op,
111 virtual const llvm::APSInt *getKnownValue(ProgramStateRef state, SVal val) = 0;
117 virtual const llvm::APSInt *getMinValue(ProgramStateRef state, SVal val) = 0;
123 virtual const llvm::APSInt *getMaxValue(ProgramStateRef state, SVal val) = 0;
[all …]
H A DProgramState.h261 ConditionTruthVal isNonNull(SVal V) const;
265 ConditionTruthVal isNull(SVal V) const;
268 ConditionTruthVal areEqual(SVal Lhs, SVal Rhs) const;
281 const LocationContext *LCtx, SVal V,
284 [[nodiscard]] ProgramStateRef bindLoc(Loc location, SVal V,
288 [[nodiscard]] ProgramStateRef bindLoc(SVal location, SVal V,
298 bindDefaultInitial(SVal loc, SVal V, const LocationContext *LCtx) const;
303 bindDefaultZero(SVal loc, const LocationContext *LCtx) const;
333 invalidateRegions(ArrayRef<SVal> Regions, const Expr *E, unsigned BlockCount,
346 SVal getSelfSVal(const LocationContext *LC) const;
[all …]
H A DBasicValueFactory.h42 llvm::ImmutableList<SVal> L;
45 CompoundValData(QualType t, llvm::ImmutableList<SVal> l) : T(t), L(l) { in CompoundValData()
49 using iterator = llvm::ImmutableList<SVal>::iterator;
57 llvm::ImmutableList<SVal> L);
124 llvm::ImmutableList<SVal>::Factory SValListFactory;
245 llvm::ImmutableList<SVal> Vals);
254 llvm::ImmutableList<SVal> getEmptySValList() { in getEmptySValList()
258 llvm::ImmutableList<SVal> prependSVal(SVal X, llvm::ImmutableList<SVal> L) { in prependSVal()
280 const std::pair<SVal, uintptr_t>&
281 getPersistentSValWithData(const SVal& V, uintptr_t Data);
[all …]
H A DExprEngine.h385 ProgramStateRef processAssume(ProgramStateRef state, SVal cond,
601 SVal evalBinOp(ProgramStateRef ST, BinaryOperator::Opcode Op, in evalBinOp()
602 SVal LHS, SVal RHS, QualType T) { in evalBinOp()
624 static std::optional<SVal>
631 ProgramStateRef State, ArrayRef<std::pair<SVal, SVal>> LocAndVals,
649 SVal location, SVal Val, bool atDeclInit = false,
654 SVal Loc, SVal Val,
659 ProgramStateRef escapeValues(ProgramStateRef State, ArrayRef<SVal> Vs,
675 SVal location,
682 ExplodedNode *Pred, ProgramStateRef St, SVal TargetLV, SVal Val,
[all …]
H A DSVals.def1 //===-- SVals.def - Metadata about SVal kinds -------------------*- C++ -*-===//
9 // The list of symbolic values (SVal kinds) used in the Static Analyzer.
10 // The distinction between `loc::` and `nonloc::` SVal namespaces is
15 // BASIC_SVAL(Id, Parent) - for specific SVal kinds, which are
18 // ABSTRACT_SVAL(Id, Parent) - for abstract SVal classes which are
50 BASIC_SVAL(UndefinedVal, SVal)
51 ABSTRACT_SVAL(DefinedOrUnknownSVal, SVal)
/src/contrib/llvm-project/clang/lib/StaticAnalyzer/Checkers/
H A DIteratorModeling.cpp94 SVal, SVal, SVal) const;
102 void handleComparison(CheckerContext &C, const Expr *CE, SVal RetVal,
103 SVal LVal, SVal RVal, OverloadedOperatorKind Op) const;
105 SymbolRef Sym1, SymbolRef Sym2, SVal RetVal,
107 void handleIncrement(CheckerContext &C, SVal RetVal, SVal Iter,
109 void handleDecrement(CheckerContext &C, SVal RetVal, SVal Iter,
112 OverloadedOperatorKind Op, SVal RetVal,
113 SVal Iterator, SVal Amount) const;
115 OverloadedOperatorKind OK, SVal Offset) const;
116 void handleAdvance(CheckerContext &C, const Expr *CE, SVal RetVal, SVal Iter,
[all …]
H A DIteratorRangeChecker.cpp38 void verifyDereference(CheckerContext &C, SVal Val) const;
39 void verifyIncrement(CheckerContext &C, SVal Iter) const;
40 void verifyDecrement(CheckerContext &C, SVal Iter) const;
42 SVal LHS, SVal RHS) const;
43 void verifyAdvance(CheckerContext &C, SVal LHS, SVal RHS) const;
44 void verifyPrev(CheckerContext &C, SVal LHS, SVal RHS) const;
45 void verifyNext(CheckerContext &C, SVal LHS, SVal RHS) const;
46 void reportBug(StringRef Message, SVal Val, CheckerContext &C,
56 using AdvanceFn = void (IteratorRangeChecker::*)(CheckerContext &, SVal,
57 SVal) const;
[all …]
H A DGTestChecker.cpp112 SVal
114 SVal Instance,
117 static ProgramStateRef assumeValuesEqual(SVal Val1, SVal Val2,
134 SVal BooleanArgVal = Call->getArgSVal(0); in modelAssertionResultBoolConstructor()
142 SVal ThisVal = Call->getCXXThisVal(); in modelAssertionResultBoolConstructor()
144 SVal ThisSuccess = getAssertionResultSuccessFieldValue( in modelAssertionResultBoolConstructor()
164 SVal OtherVal = Call->getArgSVal(0); in modelAssertionResultCopyConstructor()
165 SVal ThisVal = Call->getCXXThisVal(); in modelAssertionResultCopyConstructor()
170 SVal ThisSuccess = getAssertionResultSuccessFieldValue(AssertResultClassDecl, in modelAssertionResultCopyConstructor()
172 SVal OtherSuccess = getAssertionResultSuccessFieldValue(AssertResultClassDecl, in modelAssertionResultCopyConstructor()
[all …]
H A DContainerModeling.cpp36 void handleBegin(CheckerContext &C, const Expr *CE, SVal RetVal,
37 SVal Cont) const;
38 void handleEnd(CheckerContext &C, const Expr *CE, SVal RetVal,
39 SVal Cont) const;
40 void handleAssignment(CheckerContext &C, SVal Cont, const Expr *CE = nullptr,
41 SVal OldCont = UndefinedVal()) const;
42 void handleAssign(CheckerContext &C, SVal Cont, const Expr *ContE) const;
43 void handleClear(CheckerContext &C, SVal Cont, const Expr *ContE) const;
44 void handlePushBack(CheckerContext &C, SVal Cont, const Expr *ContE) const;
45 void handlePopBack(CheckerContext &C, SVal Cont, const Expr *ContE) const;
[all …]
H A DCStringChecker.cpp251 ProgramStateRef state, SVal V, QualType Ty);
255 SVal strLength);
256 static SVal getCStringLengthForRegion(CheckerContext &C,
261 SVal getCStringLength(CheckerContext &C,
264 SVal Buf,
270 SVal val) const;
275 const Expr *BufE, SVal BufV, SVal SizeV,
280 CheckerContext &C, ProgramStateRef S, const Expr *BufE, SVal BufV);
285 CheckerContext &C, ProgramStateRef S, const Expr *BufE, SVal BufV);
290 const Expr *BufE, SVal BufV);
[all …]
H A DMismatchedIteratorChecker.cpp37 void verifyMatch(CheckerContext &C, SVal Iter, const MemRegion *Cont) const;
38 void verifyMatch(CheckerContext &C, SVal Iter1, SVal Iter2) const;
39 void reportBug(StringRef Message, SVal Val1, SVal Val2, CheckerContext &C,
41 void reportBug(StringRef Message, SVal Val, const MemRegion *Reg,
160 SVal LHS = UndefinedVal(); in checkPreCall()
190 SVal LVal = State->getSVal(BO->getLHS(), C.getLocationContext()); in checkPreStmt()
191 SVal RVal = State->getSVal(BO->getRHS(), C.getLocationContext()); in checkPreStmt()
195 void MismatchedIteratorChecker::verifyMatch(CheckerContext &C, SVal Iter, in verifyMatch()
231 void MismatchedIteratorChecker::verifyMatch(CheckerContext &C, SVal Iter1, in verifyMatch()
232 SVal Iter2) const { in verifyMatch()
[all …]
H A DObjCSelfInitChecker.cpp54 static bool isSelfVar(SVal location, CheckerContext &C);
74 void checkLocation(SVal location, bool isLoad, const Stmt *S,
76 void checkBind(SVal loc, SVal val, const Stmt *S, CheckerContext &C) const;
106 static SelfFlagEnum getSelfFlags(SVal val, ProgramStateRef state) { in REGISTER_MAP_WITH_PROGRAMSTATE()
113 static SelfFlagEnum getSelfFlags(SVal val, CheckerContext &C) { in getSelfFlags()
117 static void addSelfFlag(ProgramStateRef state, SVal val, in addSelfFlag()
127 static bool hasSelfFlag(SVal val, SelfFlagEnum flag, CheckerContext &C) { in hasSelfFlag()
135 SVal exprVal = C.getSVal(E); in isInvalidSelf()
183 SVal V = C.getSVal(Msg.getOriginExpr()); in checkPostObjCMessage()
250 SVal argV = CE.getArgSVal(i); in checkPreCall()
[all …]
H A DTestAfterDivZeroChecker.cpp82 void reportBug(SVal Val, CheckerContext &C) const;
88 void setDivZeroMap(SVal Var, CheckerContext &C) const;
89 bool hasDivZeroMap(SVal Var, const CheckerContext &C) const;
90 bool isZero(SVal S, CheckerContext &C) const;
116 SVal S = Succ->getSVal(E); in REGISTER_SET_WITH_PROGRAMSTATE()
135 bool TestAfterDivZeroChecker::isZero(SVal S, CheckerContext &C) const { in isZero()
145 void TestAfterDivZeroChecker::setDivZeroMap(SVal Var, CheckerContext &C) const { in setDivZeroMap()
156 bool TestAfterDivZeroChecker::hasDivZeroMap(SVal Var, in hasDivZeroMap()
166 void TestAfterDivZeroChecker::reportBug(SVal Val, CheckerContext &C) const { in reportBug()
201 SVal S = C.getSVal(B->getRHS()); in checkPreStmt()
[all …]
H A DInvalidatedIteratorChecker.cpp37 void verifyAccess(CheckerContext &C, SVal Val) const;
38 void reportBug(StringRef Message, SVal Val, CheckerContext &C,
77 SVal SubVal = State->getSVal(UO->getSubExpr(), C.getLocationContext()); in checkPreStmt()
88 SVal LVal = State->getSVal(BO->getLHS(), C.getLocationContext()); in checkPreStmt()
98 SVal LVal = State->getSVal(ASE->getLHS(), C.getLocationContext()); in checkPreStmt()
108 SVal BaseVal = State->getSVal(ME->getBase(), C.getLocationContext()); in checkPreStmt()
113 SVal Val) const { in verifyAccess()
125 void InvalidatedIteratorChecker::reportBug(StringRef Message, SVal Val, in reportBug()
/src/contrib/llvm-project/clang/lib/StaticAnalyzer/Core/
H A DSimpleSValBuilder.cpp31 static const llvm::APSInt *getConstValue(ProgramStateRef state, SVal V);
35 static const llvm::APSInt *getConcreteValue(SVal V);
57 SVal simplifyUntilFixpoint(ProgramStateRef State, SVal Val);
63 SVal simplifySValOnce(ProgramStateRef State, SVal V);
71 SVal evalBinOpNN(ProgramStateRef state, BinaryOperator::Opcode op,
73 SVal evalBinOpLL(ProgramStateRef state, BinaryOperator::Opcode op,
75 SVal evalBinOpLN(ProgramStateRef state, BinaryOperator::Opcode op,
81 const llvm::APSInt *getKnownValue(ProgramStateRef state, SVal V) override;
86 const llvm::APSInt *getMinValue(ProgramStateRef state, SVal V) override;
91 const llvm::APSInt *getMaxValue(ProgramStateRef state, SVal V) override;
[all …]
H A DRegionStore.cpp147 typedef llvm::ImmutableMap<BindingKey, SVal> ClusterBindings;
148 typedef llvm::ImmutableMapRef<BindingKey, SVal> ClusterBindingsRef;
149 typedef std::pair<BindingKey, SVal> BindingPair;
197 RegionBindingsRef addBinding(BindingKey K, SVal V) const;
200 BindingKey::Kind k, SVal V) const;
202 const SVal *lookup(BindingKey K) const;
203 const SVal *lookup(const MemRegion *R, BindingKey::Kind k) const;
216 std::optional<SVal> getDirectBinding(const MemRegion *R) const;
220 std::optional<SVal> getDefaultBinding(const MemRegion *R) const;
267 std::optional<SVal>
[all …]
H A DExprEngineC.cpp29 static SVal conjureOffsetSymbolOnLocation( in conjureOffsetSymbolOnLocation()
30 SVal Symbol, SVal Other, Expr* Expression, SValBuilder &svalBuilder, in conjureOffsetSymbolOnLocation()
58 SVal LeftV = state->getSVal(LHS, LCtx); in VisitBinaryOperator()
59 SVal RightV = state->getSVal(RHS, LCtx); in VisitBinaryOperator()
73 SVal ExprVal = B->isGLValue() ? LeftV : RightV; in VisitBinaryOperator()
100 SVal Result = evalBinOp(state, Op, LeftV, RightV, B->getType()); in VisitBinaryOperator()
133 SVal location = LeftV; in VisitBinaryOperator()
139 SVal V = state->getSVal(LHS, LCtx); in VisitBinaryOperator()
156 SVal Result = svalBuilder.evalCast(evalBinOp(state, Op, V, RightV, CTy), in VisitBinaryOperator()
162 SVal LHSVal; in VisitBinaryOperator()
[all …]
H A DStore.cpp232 static bool regionMatchesCXXRecordType(SVal V, QualType Ty) { in regionMatchesCXXRecordType()
252 SVal StoreManager::evalDerivedToBase(SVal Derived, const CastExpr *Cast) { in evalDerivedToBase()
259 SVal Result = Derived; in evalDerivedToBase()
266 SVal StoreManager::evalDerivedToBase(SVal Derived, const CXXBasePath &Path) { in evalDerivedToBase()
268 SVal Result = Derived; in evalDerivedToBase()
275 SVal StoreManager::evalDerivedToBase(SVal Derived, QualType BaseType, in evalDerivedToBase()
316 std::optional<SVal> StoreManager::evalBaseToDerived(SVal Base, in evalBaseToDerived()
398 SVal StoreManager::getLValueFieldOrIvar(const Decl *D, SVal Base) { in getLValueFieldOrIvar()
439 SVal StoreManager::getLValueIvar(const ObjCIvarDecl *decl, SVal base) { in getLValueIvar()
443 SVal StoreManager::getLValueElement(QualType elementType, NonLoc Offset, in getLValueElement()
[all …]
H A DProgramState.cpp115 SVal V, in bindLoc()
129 ProgramState::bindDefaultInitial(SVal loc, SVal V, in bindDefaultInitial()
139 ProgramState::bindDefaultZero(SVal loc, const LocationContext *LCtx) const { in bindDefaultZero()
148 typedef ArrayRef<SVal> ValueList;
158 SmallVector<SVal, 8> Values; in invalidateRegions()
233 SVal ProgramState::wrapSymbolicRegion(SVal Val) const { in wrapSymbolicRegion()
251 SVal ProgramState::getSelfSVal(const LocationContext *LCtx) const { in getSelfSVal()
254 return SVal(); in getSelfSVal()
258 SVal ProgramState::getSValAsScalarOrLoc(const MemRegion *R) const { in getSValAsScalarOrLoc()
274 SVal ProgramState::getSVal(Loc location, QualType T) const { in getSVal()
[all …]
H A DSValBuilder.cpp121 SVal SValBuilder::convertToArrayIndex(SVal val) { in convertToArrayIndex()
330 std::optional<SVal> SValBuilder::getConstantVal(const Expr *E) { in getConstantVal()
400 std::optional<SVal> Val = getConstantVal(SE); in getConstantVal()
429 SVal SValBuilder::makeSymExprValNN(BinaryOperator::Opcode Op, in makeSymExprValNN()
456 SVal SValBuilder::evalMinus(NonLoc X) { in evalMinus()
468 SVal SValBuilder::evalComplement(NonLoc X) { in evalComplement()
480 SVal SValBuilder::evalUnaryOp(ProgramStateRef state, UnaryOperator::Opcode opc, in evalUnaryOp()
481 SVal operand, QualType type) { in evalUnaryOp()
493 SVal SValBuilder::evalBinOp(ProgramStateRef state, BinaryOperator::Opcode op, in evalBinOp()
494 SVal lhs, SVal rhs, QualType type) { in evalBinOp()
[all …]
H A DSVals.cpp46 const FunctionDecl *SVal::getAsFunctionDecl() const { in getAsFunctionDecl()
68 SymbolRef SVal::getAsLocSymbol(bool IncludeBaseRegions) const { in getAsLocSymbol()
80 SymbolRef SVal::getLocSymbolInBase() const { in getLocSymbolInBase()
104 SymbolRef SVal::getAsSymbol(bool IncludeBaseRegions) const { in getAsSymbol()
112 const llvm::APSInt *SVal::getAsInteger() const { in getAsInteger()
120 const MemRegion *SVal::getAsRegion() const { in getAsRegion()
181 QualType SVal::getType(const ASTContext &Context) const { in getType()
246 bool SVal::isConstant() const { in isConstant()
250 bool SVal::isConstant(int I) const { in isConstant()
258 bool SVal::isZeroConstant() const { in isZeroConstant()
[all …]
H A DBasicValueFactory.cpp33 llvm::ImmutableList<SVal> L) { in Profile()
52 using SValData = std::pair<SVal, uintptr_t>;
53 using SValPair = std::pair<SVal, SVal>;
126 llvm::ImmutableList<SVal> Vals) { in getCompoundValData()
332 const std::pair<SVal, uintptr_t>&
333 BasicValueFactory::getPersistentSValWithData(const SVal& V, uintptr_t Data) { in getPersistentSValWithData()
356 const std::pair<SVal, SVal>&
357 BasicValueFactory::getPersistentSValPair(const SVal& V1, const SVal& V2) { in getPersistentSValPair()
380 const SVal* BasicValueFactory::getPersistentSVal(SVal X) { in getPersistentSVal()
H A DExprEngineCXX.cpp46 SVal ThisVal; in performTrivialCopy()
76 SVal V = Call.getArgSVal(0); in performTrivialCopy()
100 SVal ExprEngine::makeElementRegion(ProgramStateRef State, SVal LValue, in makeElementRegion()
121 SVal ExprEngine::computeObjectUnderConstruction( in computeObjectUnderConstruction()
148 SVal ThisVal = State->getSVal(ThisPtr); in computeObjectUnderConstruction()
162 SVal FieldVal; in computeObjectUnderConstruction()
179 SVal V = *getObjectUnderConstruction(State, NE, LCtx); in computeObjectUnderConstruction()
265 SVal V = computeObjectUnderConstruction( in computeObjectUnderConstruction()
316 SVal Base = loc::MemRegionVal( in computeObjectUnderConstruction()
337 auto getArgLoc = [&](CallEventRef<> Caller) -> std::optional<SVal> { in computeObjectUnderConstruction()
[all …]

123456