clang 10.0.0git

SValBuilder.h
Go to the documentation of this file.
1 // SValBuilder.h - Construction of SVals from evaluating expressions -*- C++ -*-
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines SValBuilder, a class that defines the interface for
10 // "symbolical evaluators" which construct an SVal from an expression.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SVALBUILDER_H
15 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SVALBUILDER_H
16
17 #include "clang/AST/ASTContext.h"
18 #include "clang/AST/DeclarationName.h"
19 #include "clang/AST/Expr.h"
20 #include "clang/AST/ExprObjC.h"
21 #include "clang/AST/Type.h"
22 #include "clang/Basic/LLVM.h"
23 #include "clang/Basic/LangOptions.h"
24 #include "clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h"
25 #include "clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h"
26 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h"
27 #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
28 #include "clang/StaticAnalyzer/Core/PathSensitive/SymExpr.h"
29 #include "clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h"
30 #include "llvm/ADT/ImmutableList.h"
31 #include "llvm/ADT/Optional.h"
32 #include <cstdint>
33
34 namespace clang {
35
36 class BlockDecl;
37 class CXXBoolLiteralExpr;
38 class CXXMethodDecl;
39 class CXXRecordDecl;
40 class DeclaratorDecl;
41 class FunctionDecl;
42 class LocationContext;
43 class StackFrameContext;
44 class Stmt;
45
46 namespace ento {
47
48 class ConditionTruthVal;
49 class ProgramStateManager;
50 class StoreRef;
51
52 class SValBuilder {
53 virtual void anchor();
54
55 protected:
56 ASTContext &Context;
57
58 /// Manager of APSInt values.
59 BasicValueFactory BasicVals;
60
61 /// Manages the creation of symbols.
62 SymbolManager SymMgr;
63
64 /// Manages the creation of memory regions.
65 MemRegionManager MemMgr;
66
67 ProgramStateManager &StateMgr;
68
69 /// The scalar type to use for array indices.
70 const QualType ArrayIndexTy;
71
72 /// The width of the scalar type used for array indices.
73 const unsigned ArrayIndexWidth;
74
75 virtual SVal evalCastFromNonLoc(NonLoc val, QualType castTy) = 0;
76 virtual SVal evalCastFromLoc(Loc val, QualType castTy) = 0;
77
78 public:
79 // FIXME: Make these protected again once RegionStoreManager correctly
80 // handles loads from different bound value types.
81 virtual SVal dispatchCast(SVal val, QualType castTy) = 0;
82
83 public:
84 SValBuilder(llvm::BumpPtrAllocator &alloc, ASTContext &context,
85 ProgramStateManager &stateMgr)
86 : Context(context), BasicVals(context, alloc),
87 SymMgr(context, BasicVals, alloc), MemMgr(context, alloc),
88 StateMgr(stateMgr), ArrayIndexTy(context.LongLongTy),
89 ArrayIndexWidth(context.getTypeSize(ArrayIndexTy)) {}
90
91 virtual ~SValBuilder() = default;
92
93 bool haveSameType(const SymExpr *Sym1, const SymExpr *Sym2) {
94 return haveSameType(Sym1->getType(), Sym2->getType());
95 }
96
97 bool haveSameType(QualType Ty1, QualType Ty2) {
98 // FIXME: Remove the second disjunct when we support symbolic
99 // truncation/extension.
100 return (Context.getCanonicalType(Ty1) == Context.getCanonicalType(Ty2) ||
101 (Ty1->isIntegralOrEnumerationType() &&
102 Ty2->isIntegralOrEnumerationType()));
103 }
104
105 SVal evalCast(SVal val, QualType castTy, QualType originalType);
106
107 // Handles casts of type CK_IntegralCast.
108 SVal evalIntegralCast(ProgramStateRef state, SVal val, QualType castTy,
109 QualType originalType);
110
111 virtual SVal evalMinus(NonLoc val) = 0;
112
113 virtual SVal evalComplement(NonLoc val) = 0;
114
115 /// Create a new value which represents a binary expression with two non-
116 /// location operands.
117 virtual SVal evalBinOpNN(ProgramStateRef state, BinaryOperator::Opcode op,
118 NonLoc lhs, NonLoc rhs, QualType resultTy) = 0;
119
120 /// Create a new value which represents a binary expression with two memory
121 /// location operands.
122 virtual SVal evalBinOpLL(ProgramStateRef state, BinaryOperator::Opcode op,
123 Loc lhs, Loc rhs, QualType resultTy) = 0;
124
125 /// Create a new value which represents a binary expression with a memory
126 /// location and non-location operands. For example, this would be used to
127 /// evaluate a pointer arithmetic operation.
128 virtual SVal evalBinOpLN(ProgramStateRef state, BinaryOperator::Opcode op,
129 Loc lhs, NonLoc rhs, QualType resultTy) = 0;
130
131 /// Evaluates a given SVal. If the SVal has only one possible (integer) value,
132 /// that value is returned. Otherwise, returns NULL.
133 virtual const llvm::APSInt *getKnownValue(ProgramStateRef state, SVal val) = 0;
134
135 /// Simplify symbolic expressions within a given SVal. Return an SVal
136 /// that represents the same value, but is hopefully easier to work with
137 /// than the original SVal.
138 virtual SVal simplifySVal(ProgramStateRef State, SVal Val) = 0;
139
140 /// Constructs a symbolic expression for two non-location values.
141 SVal makeSymExprValNN(BinaryOperator::Opcode op,
142 NonLoc lhs, NonLoc rhs, QualType resultTy);
143
144 SVal evalBinOp(ProgramStateRef state, BinaryOperator::Opcode op,
145 SVal lhs, SVal rhs, QualType type);
146
147 /// \return Whether values in \p lhs and \p rhs are equal at \p state.
148 ConditionTruthVal areEqual(ProgramStateRef state, SVal lhs, SVal rhs);
149
150 SVal evalEQ(ProgramStateRef state, SVal lhs, SVal rhs);
151
152 DefinedOrUnknownSVal evalEQ(ProgramStateRef state, DefinedOrUnknownSVal lhs,
153 DefinedOrUnknownSVal rhs);
154
155 ASTContext &getContext() { return Context; }
156 const ASTContext &getContext() const { return Context; }
157
158 ProgramStateManager &getStateManager() { return StateMgr; }
159
160 QualType getConditionType() const {
161 return Context.getLangOpts().CPlusPlus ? Context.BoolTy : Context.IntTy;
162 }
163
164 QualType getArrayIndexType() const {
165 return ArrayIndexTy;
166 }
167
168 BasicValueFactory &getBasicValueFactory() { return BasicVals; }
169 const BasicValueFactory &getBasicValueFactory() const { return BasicVals; }
170
171 SymbolManager &getSymbolManager() { return SymMgr; }
172 const SymbolManager &getSymbolManager() const { return SymMgr; }
173
174 MemRegionManager &getRegionManager() { return MemMgr; }
175 const MemRegionManager &getRegionManager() const { return MemMgr; }
176
177 // Forwarding methods to SymbolManager.
178
179 const SymbolConjured* conjureSymbol(const Stmt *stmt,
180 const LocationContext *LCtx,
181 QualType type,
182 unsigned visitCount,
183 const void *symbolTag = nullptr) {
184 return SymMgr.conjureSymbol(stmt, LCtx, type, visitCount, symbolTag);
185 }
186
187 const SymbolConjured* conjureSymbol(const Expr *expr,
188 const LocationContext *LCtx,
189 unsigned visitCount,
190 const void *symbolTag = nullptr) {
191 return SymMgr.conjureSymbol(expr, LCtx, visitCount, symbolTag);
192 }
193
194 /// Construct an SVal representing '0' for the specified type.
195 DefinedOrUnknownSVal makeZeroVal(QualType type);
196
197 /// Make a unique symbol for value of region.
198 DefinedOrUnknownSVal getRegionValueSymbolVal(const TypedValueRegion *region);
199
200 /// Create a new symbol with a unique 'name'.
201 ///
202 /// We resort to conjured symbols when we cannot construct a derived symbol.
203 /// The advantage of symbols derived/built from other symbols is that we
204 /// preserve the relation between related(or even equivalent) expressions, so
205 /// conjured symbols should be used sparingly.
206 DefinedOrUnknownSVal conjureSymbolVal(const void *symbolTag,
207 const Expr *expr,
208 const LocationContext *LCtx,
209 unsigned count);
210 DefinedOrUnknownSVal conjureSymbolVal(const void *symbolTag,
211 const Expr *expr,
212 const LocationContext *LCtx,
213 QualType type,
214 unsigned count);
215 DefinedOrUnknownSVal conjureSymbolVal(const Stmt *stmt,
216 const LocationContext *LCtx,
217 QualType type,
218 unsigned visitCount);
219
220 /// Conjure a symbol representing heap allocated memory region.
221 ///
222 /// Note, the expression should represent a location.
223 DefinedOrUnknownSVal getConjuredHeapSymbolVal(const Expr *E,
224 const LocationContext *LCtx,
225 unsigned Count);
226
227 DefinedOrUnknownSVal getDerivedRegionValueSymbolVal(
228 SymbolRef parentSymbol, const TypedValueRegion *region);
229
230 DefinedSVal getMetadataSymbolVal(const void *symbolTag,
231 const MemRegion *region,
232 const Expr *expr, QualType type,
233 const LocationContext *LCtx,
234 unsigned count);
235
236 DefinedSVal getMemberPointer(const DeclaratorDecl *DD);
237
238 DefinedSVal getFunctionPointer(const FunctionDecl *func);
239
240 DefinedSVal getBlockPointer(const BlockDecl *block, CanQualType locTy,
241 const LocationContext *locContext,
242 unsigned blockCount);
243
244 /// Returns the value of \p E, if it can be determined in a non-path-sensitive
245 /// manner.
246 ///
247 /// If \p E is not a constant or cannot be modeled, returns \c None.
248 Optional<SVal> getConstantVal(const Expr *E);
249
250 NonLoc makeCompoundVal(QualType type, llvm::ImmutableList<SVal> vals) {
251 return nonloc::CompoundVal(BasicVals.getCompoundValData(type, vals));
252 }
253
254 NonLoc makeLazyCompoundVal(const StoreRef &store,
255 const TypedValueRegion *region) {
256 return nonloc::LazyCompoundVal(
257 BasicVals.getLazyCompoundValData(store, region));
258 }
259
260 NonLoc makePointerToMember(const DeclaratorDecl *DD) {
261 return nonloc::PointerToMember(DD);
262 }
263
264 NonLoc makePointerToMember(const PointerToMemberData *PTMD) {
265 return nonloc::PointerToMember(PTMD);
266 }
267
268 NonLoc makeZeroArrayIndex() {
269 return nonloc::ConcreteInt(BasicVals.getValue(0, ArrayIndexTy));
270 }
271
272 NonLoc makeArrayIndex(uint64_t idx) {
273 return nonloc::ConcreteInt(BasicVals.getValue(idx, ArrayIndexTy));
274 }
275
276 SVal convertToArrayIndex(SVal val);
277
278 nonloc::ConcreteInt makeIntVal(const IntegerLiteral* integer) {
279 return nonloc::ConcreteInt(
280 BasicVals.getValue(integer->getValue(),
281 integer->getType()->isUnsignedIntegerOrEnumerationType()));
282 }
283
284 nonloc::ConcreteInt makeBoolVal(const ObjCBoolLiteralExpr *boolean) {
285 return makeTruthVal(boolean->getValue(), boolean->getType());
286 }
287
288 nonloc::ConcreteInt makeBoolVal(const CXXBoolLiteralExpr *boolean);
289
290 nonloc::ConcreteInt makeIntVal(const llvm::APSInt& integer) {
291 return nonloc::ConcreteInt(BasicVals.getValue(integer));
292 }
293
294 loc::ConcreteInt makeIntLocVal(const llvm::APSInt &integer) {
295 return loc::ConcreteInt(BasicVals.getValue(integer));
296 }
297
298 NonLoc makeIntVal(const llvm::APInt& integer, bool isUnsigned) {
299 return nonloc::ConcreteInt(BasicVals.getValue(integer, isUnsigned));
300 }
301
302 DefinedSVal makeIntVal(uint64_t integer, QualType type) {
303 if (Loc::isLocType(type))
304 return loc::ConcreteInt(BasicVals.getValue(integer, type));
305
306 return nonloc::ConcreteInt(BasicVals.getValue(integer, type));
307 }
308
309 NonLoc makeIntVal(uint64_t integer, bool isUnsigned) {
310 return nonloc::ConcreteInt(BasicVals.getIntValue(integer, isUnsigned));
311 }
312
313 NonLoc makeIntValWithPtrWidth(uint64_t integer, bool isUnsigned) {
314 return nonloc::ConcreteInt(
315 BasicVals.getIntWithPtrWidth(integer, isUnsigned));
316 }
317
318 NonLoc makeLocAsInteger(Loc loc, unsigned bits) {
319 return nonloc::LocAsInteger(BasicVals.getPersistentSValWithData(loc, bits));
320 }
321
322 NonLoc makeNonLoc(const SymExpr *lhs, BinaryOperator::Opcode op,
323 const llvm::APSInt& rhs, QualType type);
324
325 NonLoc makeNonLoc(const llvm::APSInt& rhs, BinaryOperator::Opcode op,
326 const SymExpr *lhs, QualType type);
327
328 NonLoc makeNonLoc(const SymExpr *lhs, BinaryOperator::Opcode op,
329 const SymExpr *rhs, QualType type);
330
331 /// Create a NonLoc value for cast.
332 NonLoc makeNonLoc(const SymExpr *operand, QualType fromTy, QualType toTy);
333
334 nonloc::ConcreteInt makeTruthVal(bool b, QualType type) {
335 return nonloc::ConcreteInt(BasicVals.getTruthValue(b, type));
336 }
337
338 nonloc::ConcreteInt makeTruthVal(bool b) {
339 return nonloc::ConcreteInt(BasicVals.getTruthValue(b));
340 }
341
342 /// Create NULL pointer, with proper pointer bit-width for given address
343 /// space.
344 /// \param type pointer type.
345 Loc makeNullWithType(QualType type) {
346 return loc::ConcreteInt(BasicVals.getZeroWithTypeSize(type));
347 }
348
349 Loc makeNull() {
350 return loc::ConcreteInt(BasicVals.getZeroWithPtrWidth());
351 }
352
353 Loc makeLoc(SymbolRef sym) {
354 return loc::MemRegionVal(MemMgr.getSymbolicRegion(sym));
355 }
356
357 Loc makeLoc(const MemRegion* region) {
358 return loc::MemRegionVal(region);
359 }
360
361 Loc makeLoc(const AddrLabelExpr *expr) {
362 return loc::GotoLabel(expr->getLabel());
363 }
364
365 Loc makeLoc(const llvm::APSInt& integer) {
366 return loc::ConcreteInt(BasicVals.getValue(integer));
367 }
368
369 /// Make an SVal that represents the given symbol. This follows the convention
370 /// of representing Loc-type symbols (symbolic pointers and references)
371 /// as Loc values wrapping the symbol rather than as plain symbol values.
372 SVal makeSymbolVal(SymbolRef Sym) {
373 if (Loc::isLocType(Sym->getType()))
374 return makeLoc(Sym);
375 return nonloc::SymbolVal(Sym);
376 }
377
378 /// Return a memory region for the 'this' object reference.
379 loc::MemRegionVal getCXXThis(const CXXMethodDecl *D,
380 const StackFrameContext *SFC);
381
382 /// Return a memory region for the 'this' object reference.
383 loc::MemRegionVal getCXXThis(const CXXRecordDecl *D,
384 const StackFrameContext *SFC);
385 };
386
387 SValBuilder* createSimpleSValBuilder(llvm::BumpPtrAllocator &alloc,
388 ASTContext &context,
389 ProgramStateManager &stateMgr);
390
391 } // namespace ento
392
393 } // namespace clang
394
395 #endif // LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SVALBUILDER_H
clang::ento::DefinedSVal
Definition: SVals.h:262
ASTContext.h
Defines the clang::ASTContext interface.
ento
SVals.h
clang::FunctionDecl
Represents a function declaration or definition.
Definition: Decl.h:1783
clang::ento::SymbolManager::conjureSymbol
const SymbolConjured * conjureSymbol(const Stmt *E, const LocationContext *LCtx, QualType T, unsigned VisitCount, const void *SymbolTag=nullptr)
clang::ObjCBoolLiteralExpr::getValue
bool getValue() const
Definition: ExprObjC.h:97
clang::ento::TypedValueRegion
TypedValueRegion - An abstract class representing regions having a typed value.
Definition: MemRegion.h:530
clang::ento::SValBuilder::makeIntVal
nonloc::ConcreteInt makeIntVal(const IntegerLiteral *integer)
Definition: SValBuilder.h:278
clang::ento::SValBuilder::getBlockPointer
DefinedSVal getBlockPointer(const BlockDecl *block, CanQualType locTy, const LocationContext *locContext, unsigned blockCount)
Definition: SValBuilder.cpp:259
clang::ento::SValBuilder::getSymbolManager
SymbolManager & getSymbolManager()
Definition: SValBuilder.h:171
clang::ento::SValBuilder::getArrayIndexType
QualType getArrayIndexType() const
Definition: SValBuilder.h:164
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:654
clang::ento::MemRegion
MemRegion - The root abstract class for all memory regions.
Definition: MemRegion.h:94
clang::ento::nonloc::CompoundVal
Definition: SVals.h:457
clang::Type::isUnsignedIntegerOrEnumerationType
bool isUnsignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is unsigned or an enumeration types whose underlying ...
Definition: Type.cpp:1984
clang::ast_matchers::stmt
const internal::VariadicAllOfMatcher< Stmt > stmt
Matches statements.
Definition: ASTMatchersInternal.cpp:661
clang::ento::BasicValueFactory::getCompoundValData
const CompoundValData * getCompoundValData(QualType T, llvm::ImmutableList< SVal > Vals)
Definition: BasicValueFactory.cpp:125
clang::ento::createSimpleSValBuilder
SValBuilder * createSimpleSValBuilder(llvm::BumpPtrAllocator &alloc, ASTContext &context, ProgramStateManager &stateMgr)
Definition: SimpleSValBuilder.cpp:58
clang::Stmt
Stmt - This represents one statement.
Definition: Stmt.h:66
Type.h
C Language Family Type Representation.
clang::ento::SValBuilder::StateMgr
ProgramStateManager & StateMgr
Definition: SValBuilder.h:67
clang::IntegerLiteral
Definition: Expr.h:1446
clang::ento::BasicValueFactory::getZeroWithTypeSize
const llvm::APSInt & getZeroWithTypeSize(QualType T)
Definition: BasicValueFactory.h:199
clang::ento::SValBuilder::simplifySVal
virtual SVal simplifySVal(ProgramStateRef State, SVal Val)=0
Simplify symbolic expressions within a given SVal.
clang::LocationContext
Definition: AnalysisDeclContext.h:216
clang::ento::SValBuilder::Context
ASTContext & Context
Definition: SValBuilder.h:56
MemRegion.h
clang::ento::SValBuilder::evalCast
SVal evalCast(SVal val, QualType castTy, QualType originalType)
Definition: SValBuilder.cpp:525
clang::ento::nonloc::ConcreteInt
Value representing integer constant.
Definition: SVals.h:379
clang::ento::SValBuilder::MemMgr
MemRegionManager MemMgr
Manages the creation of memory regions.
Definition: SValBuilder.h:65
clang::ento::BasicValueFactory::getTruthValue
const llvm::APSInt & getTruthValue(bool b, QualType T)
Definition: BasicValueFactory.h:212
clang::ast_matchers::expr
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
Definition: ASTMatchersInternal.cpp:736
clang::ento::SValBuilder::dispatchCast
virtual SVal dispatchCast(SVal val, QualType castTy)=0
clang::ento::SValBuilder::getCXXThis
loc::MemRegionVal getCXXThis(const CXXMethodDecl *D, const StackFrameContext *SFC)
Return a memory region for the &#39;this&#39; object reference.
Definition: SValBuilder.cpp:271
clang::ento::SValBuilder::makeNonLoc
NonLoc makeNonLoc(const SymExpr *lhs, BinaryOperator::Opcode op, const llvm::APSInt &rhs, QualType type)
Definition: SValBuilder.cpp:67
clang::ento::SValBuilder::makeArrayIndex
NonLoc makeArrayIndex(uint64_t idx)
Definition: SValBuilder.h:272
clang::ento::SValBuilder::BasicVals
BasicValueFactory BasicVals
Manager of APSInt values.
Definition: SValBuilder.h:59
clang::ento::BasicValueFactory
Definition: BasicValueFactory.h:106
clang::ento::SymExpr
Symbolic value.
Definition: SymExpr.h:29
clang::ento::SValBuilder::evalCastFromNonLoc
virtual SVal evalCastFromNonLoc(NonLoc val, QualType castTy)=0
clang::ento::SValBuilder::evalBinOpLN
virtual SVal evalBinOpLN(ProgramStateRef state, BinaryOperator::Opcode op, Loc lhs, NonLoc rhs, QualType resultTy)=0
Create a new value which represents a binary expression with a memory location and non-location opera...
clang::ento::SValBuilder::getRegionManager
MemRegionManager & getRegionManager()
Definition: SValBuilder.h:174
clang::ento::SValBuilder::makeSymbolVal
SVal makeSymbolVal(SymbolRef Sym)
Make an SVal that represents the given symbol.
Definition: SValBuilder.h:372
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:168
llvm::Optional
Definition: LLVM.h:37
State
LineState State
Definition: UnwrappedLineFormatter.cpp:932
clang::ento::SValBuilder::evalIntegralCast
SVal evalIntegralCast(ProgramStateRef state, SVal val, QualType castTy, QualType originalType)
Definition: SValBuilder.cpp:489
clang::ento::SValBuilder::makeNullWithType
Loc makeNullWithType(QualType type)
Create NULL pointer, with proper pointer bit-width for given address space.
Definition: SValBuilder.h:345
ProgramState_Fwd.h
clang::ento::SValBuilder::getDerivedRegionValueSymbolVal
DefinedOrUnknownSVal getDerivedRegionValueSymbolVal(SymbolRef parentSymbol, const TypedValueRegion *region)
Definition: SValBuilder.cpp:221
clang::CodeGen::state
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
Definition: CGOpenMPRuntime.h:802
clang::Type::isIntegralOrEnumerationType
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
Definition: Type.h:6881
clang::ento::MemRegionManager::getSymbolicRegion
const SymbolicRegion * getSymbolicRegion(SymbolRef Sym)
Retrieve or create a "symbolic" memory region.
Definition: MemRegion.cpp:1023
clang::ento::PointerToMemberData
Definition: BasicValueFactory.h:81
clang::ento::SymbolManager
Definition: SymbolManager.h:460
clang::ento::Loc::isLocType
static bool isLocType(QualType T)
Definition: SVals.h:329
clang::BinaryOperatorKind
BinaryOperatorKind
Definition: OperationKinds.h:25
LLVM.h
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
clang::ento::SValBuilder::makeSymExprValNN
SVal makeSymExprValNN(BinaryOperator::Opcode op, NonLoc lhs, NonLoc rhs, QualType resultTy)
Constructs a symbolic expression for two non-location values.
Definition: SValBuilder.cpp:377
clang::ento::SValBuilder::makePointerToMember
NonLoc makePointerToMember(const DeclaratorDecl *DD)
Definition: SValBuilder.h:260
clang::ento::SValBuilder::getRegionValueSymbolVal
DefinedOrUnknownSVal getRegionValueSymbolVal(const TypedValueRegion *region)
Make a unique symbol for value of region.
Definition: SValBuilder.cpp:118
clang::ento::DefinedOrUnknownSVal
Definition: SVals.h:229
clang::ento::SValBuilder::makeLoc
Loc makeLoc(const MemRegion *region)
Definition: SValBuilder.h:357
clang::ento::SValBuilder::makeLoc
Loc makeLoc(const AddrLabelExpr *expr)
Definition: SValBuilder.h:361
clang::ento::SValBuilder::makeIntLocVal
loc::ConcreteInt makeIntLocVal(const llvm::APSInt &integer)
Definition: SValBuilder.h:294
clang::ento::SValBuilder::makeNull
Loc makeNull()
Definition: SValBuilder.h:349
ExprObjC.h
clang::ento::SValBuilder::makeCompoundVal
NonLoc makeCompoundVal(QualType type, llvm::ImmutableList< SVal > vals)
Definition: SValBuilder.h:250
clang::ento::SValBuilder::getFunctionPointer
DefinedSVal getFunctionPointer(const FunctionDecl *func)
Definition: SValBuilder.cpp:255
clang::ento::SValBuilder::makeIntValWithPtrWidth
NonLoc makeIntValWithPtrWidth(uint64_t integer, bool isUnsigned)
Definition: SValBuilder.h:313
clang::ento::SValBuilder::haveSameType
bool haveSameType(QualType Ty1, QualType Ty2)
Definition: SValBuilder.h:97
BasicValueFactory.h
clang::ento::BasicValueFactory::getIntValue
const llvm::APSInt & getIntValue(uint64_t X, bool isUnsigned)
Definition: BasicValueFactory.h:166
clang::ento::loc::GotoLabel
Definition: SVals.h:574
clang::ento::SymExpr::getType
virtual QualType getType() const =0
clang::DeclaratorDecl
Represents a ValueDecl that came out of a declarator.
Definition: Decl.h:671
clang::ento::SValBuilder::makeBoolVal
nonloc::ConcreteInt makeBoolVal(const ObjCBoolLiteralExpr *boolean)
Definition: SValBuilder.h:284
clang::ento::SValBuilder::areEqual
ConditionTruthVal areEqual(ProgramStateRef state, SVal lhs, SVal rhs)
Definition: SValBuilder.cpp:437
clang::ento::SValBuilder::makeLoc
Loc makeLoc(SymbolRef sym)
Definition: SValBuilder.h:353
clang::ento::SValBuilder::makeZeroVal
DefinedOrUnknownSVal makeZeroVal(QualType type)
Construct an SVal representing &#39;0&#39; for the specified type.
Definition: SValBuilder.cpp:52
clang::BlockDecl
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:4037
clang::Expr
This represents one expression.
Definition: Expr.h:108
LangOptions.h
Defines the clang::LangOptions interface.
clang::ento::SValBuilder::evalMinus
virtual SVal evalMinus(NonLoc val)=0
clang::ento::BasicValueFactory::getIntWithPtrWidth
const llvm::APSInt & getIntWithPtrWidth(uint64_t X, bool isUnsigned)
Definition: BasicValueFactory.h:208
clang::ento::SValBuilder::makeTruthVal
nonloc::ConcreteInt makeTruthVal(bool b)
Definition: SValBuilder.h:338
clang::ento::SValBuilder::ArrayIndexTy
const QualType ArrayIndexTy
The scalar type to use for array indices.
Definition: SValBuilder.h:70
clang::ento::SValBuilder::getConditionType
QualType getConditionType() const
Definition: SValBuilder.h:160
clang::ento::StoreRef
Definition: StoreRef.h:29
clang::Expr::getType
QualType getType() const
Definition: Expr.h:137
clang::ento::SValBuilder::evalBinOpLL
virtual SVal evalBinOpLL(ProgramStateRef state, BinaryOperator::Opcode op, Loc lhs, Loc rhs, QualType resultTy)=0
Create a new value which represents a binary expression with two memory location operands.
clang::ento::SValBuilder::evalBinOp
SVal evalBinOp(ProgramStateRef state, BinaryOperator::Opcode op, SVal lhs, SVal rhs, QualType type)
Definition: SValBuilder.cpp:404
clang::ento::NonLoc
Definition: SVals.h:298
clang::ento::SValBuilder::getBasicValueFactory
const BasicValueFactory & getBasicValueFactory() const
Definition: SValBuilder.h:169
clang::ento::SValBuilder::makeIntVal
nonloc::ConcreteInt makeIntVal(const llvm::APSInt &integer)
Definition: SValBuilder.h:290
clang::ento::SValBuilder::makeZeroArrayIndex
NonLoc makeZeroArrayIndex()
Definition: SValBuilder.h:268
clang::ento::SValBuilder::makeIntVal
NonLoc makeIntVal(uint64_t integer, bool isUnsigned)
Definition: SValBuilder.h:309
clang::ento::MemRegionManager
Definition: MemRegion.h:1244
clang::ento::loc::ConcreteInt
Definition: SVals.h:640
clang::prec::PointerToMember
Definition: OperatorPrecedence.h:42
clang::ento::Loc
Definition: SVals.h:320
llvm::IntrusiveRefCntPtr< const ProgramState >
clang::ento::SValBuilder::conjureSymbolVal
DefinedOrUnknownSVal conjureSymbolVal(const void *symbolTag, const Expr *expr, const LocationContext *LCtx, unsigned count)
Create a new symbol with a unique &#39;name&#39;.
clang::ento::SValBuilder::SymMgr
SymbolManager SymMgr
Manages the creation of symbols.
Definition: SValBuilder.h:62
APSInt
llvm::APSInt APSInt
Definition: ByteCodeEmitter.cpp:18
clang::ento::SValBuilder::evalCastFromLoc
virtual SVal evalCastFromLoc(Loc val, QualType castTy)=0
DeclarationName.h
clang::CXXMethodDecl
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:1931
clang::ento::SValBuilder::getContext
ASTContext & getContext()
Definition: SValBuilder.h:155
clang::ento::SVal
SVal - This represents a symbolic expression, which can be either an L-value or an R-value...
Definition: SVals.h:75
clang::CanQual< Type >
clang::ento::BasicValueFactory::getZeroWithPtrWidth
const llvm::APSInt & getZeroWithPtrWidth(bool isUnsigned=true)
Definition: BasicValueFactory.h:204
clang::interp::APInt
llvm::APInt APInt
Definition: Integral.h:27
clang::ento::ProgramStateManager
Definition: ProgramState.h:456
clang::ento::SValBuilder::getConjuredHeapSymbolVal
DefinedOrUnknownSVal getConjuredHeapSymbolVal(const Expr *E, const LocationContext *LCtx, unsigned Count)
Conjure a symbol representing heap allocated memory region.
Definition: SValBuilder.cpp:191
SymbolManager.h
clang::ento::SymbolConjured
A symbol representing the result of an expression in the case when we do not know anything about what...
Definition: SymbolManager.h:75
clang::ento::SValBuilder::evalBinOpNN
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.
clang::ento::SValBuilder::ArrayIndexWidth
const unsigned ArrayIndexWidth
The width of the scalar type used for array indices.
Definition: SValBuilder.h:73
clang::ento::SValBuilder::getRegionManager
const MemRegionManager & getRegionManager() const
Definition: SValBuilder.h:175
clang::AddrLabelExpr
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:3910
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:21
clang::ento::SValBuilder::makeIntVal
NonLoc makeIntVal(const llvm::APInt &integer, bool isUnsigned)
Definition: SValBuilder.h:298
type
clang::ento::SValBuilder::conjureSymbol
const SymbolConjured * conjureSymbol(const Stmt *stmt, const LocationContext *LCtx, QualType type, unsigned visitCount, const void *symbolTag=nullptr)
Definition: SValBuilder.h:179
clang::ento::SValBuilder::makeLocAsInteger
NonLoc makeLocAsInteger(Loc loc, unsigned bits)
Definition: SValBuilder.h:318
clang::ento::SValBuilder::getStateManager
ProgramStateManager & getStateManager()
Definition: SValBuilder.h:158
clang::ento::SValBuilder::evalEQ
SVal evalEQ(ProgramStateRef state, SVal lhs, SVal rhs)
Definition: SValBuilder.cpp:442
clang::ento::SValBuilder
Definition: SValBuilder.h:52
clang::ento::nonloc::SymbolVal
Represents symbolic expression that isn&#39;t a location.
Definition: SVals.h:349
clang::ento::SValBuilder::convertToArrayIndex
SVal convertToArrayIndex(SVal val)
Definition: SValBuilder.cpp:99
clang::ento::SValBuilder::getMetadataSymbolVal
DefinedSVal getMetadataSymbolVal(const void *symbolTag, const MemRegion *region, const Expr *expr, QualType type, const LocationContext *LCtx, unsigned count)
Definition: SValBuilder.cpp:204
clang::APIntStorage::getValue
llvm::APInt getValue() const
Definition: Expr.h:1430
clang::AddrLabelExpr::getLabel
LabelDecl * getLabel() const
Definition: Expr.h:3932
clang::ento::SValBuilder::getBasicValueFactory
BasicValueFactory & getBasicValueFactory()
Definition: SValBuilder.h:168
SymExpr.h
clang::ento::SValBuilder::makeLoc
Loc makeLoc(const llvm::APSInt &integer)
Definition: SValBuilder.h:365
clang::ento::SValBuilder::getMemberPointer
DefinedSVal getMemberPointer(const DeclaratorDecl *DD)
Definition: SValBuilder.cpp:239
clang::ento::SValBuilder::SValBuilder
SValBuilder(llvm::BumpPtrAllocator &alloc, ASTContext &context, ProgramStateManager &stateMgr)
Definition: SValBuilder.h:84
clang::ento::nonloc::LazyCompoundVal
Definition: SVals.h:486
clang::StackFrameContext
Definition: AnalysisDeclContext.h:296
clang::ento::BasicValueFactory::getPersistentSValWithData
const std::pair< SVal, uintptr_t > & getPersistentSValWithData(const SVal &V, uintptr_t Data)
Definition: BasicValueFactory.cpp:300
clang::ento::nonloc::LocAsInteger
Definition: SVals.h:410
clang::ASTContext::getCanonicalType
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
Definition: ASTContext.h:2305
clang::ento::SValBuilder::haveSameType
bool haveSameType(const SymExpr *Sym1, const SymExpr *Sym2)
Definition: SValBuilder.h:93
clang::ento::BasicValueFactory::getLazyCompoundValData
const LazyCompoundValData * getLazyCompoundValData(const StoreRef &store, const TypedValueRegion *region)
Definition: BasicValueFactory.cpp:143
clang::CXXRecordDecl
Represents a C++ struct/union/class.
Definition: DeclCXX.h:253
clang::ento::SValBuilder::evalComplement
virtual SVal evalComplement(NonLoc val)=0
clang::ento::SValBuilder::getConstantVal
Optional< SVal > getConstantVal(const Expr *E)
Returns the value of E, if it can be determined in a non-path-sensitive manner.
Definition: SValBuilder.cpp:285
clang::ento::SValBuilder::conjureSymbol
const SymbolConjured * conjureSymbol(const Expr *expr, const LocationContext *LCtx, unsigned visitCount, const void *symbolTag=nullptr)
Definition: SValBuilder.h:187
Expr.h
clang::ento::SValBuilder::~SValBuilder
virtual ~SValBuilder()=default
clang::ento::SValBuilder::getKnownValue
virtual const llvm::APSInt * getKnownValue(ProgramStateRef state, SVal val)=0
Evaluates a given SVal.
clang::ASTContext::IntTy
CanQualType IntTy
Definition: ASTContext.h:1025
clang::ObjCBoolLiteralExpr
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition: ExprObjC.h:85
clang::ento::SValBuilder::makePointerToMember
NonLoc makePointerToMember(const PointerToMemberData *PTMD)
Definition: SValBuilder.h:264
clang::ento::SValBuilder::getContext
const ASTContext & getContext() const
Definition: SValBuilder.h:156
clang::ento::SValBuilder::makeTruthVal
nonloc::ConcreteInt makeTruthVal(bool b, QualType type)
Definition: SValBuilder.h:334
clang::ento::SValBuilder::makeIntVal
DefinedSVal makeIntVal(uint64_t integer, QualType type)
Definition: SValBuilder.h:302
clang::ento::SValBuilder::makeLazyCompoundVal
NonLoc makeLazyCompoundVal(const StoreRef &store, const TypedValueRegion *region)
Definition: SValBuilder.h:254
clang::CXXBoolLiteralExpr
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition: ExprCXX.h:645
clang::ASTContext::BoolTy
CanQualType BoolTy
Definition: ASTContext.h:1017
clang::ento::loc::MemRegionVal
Definition: SVals.h:598
clang::ento::SValBuilder::getSymbolManager
const SymbolManager & getSymbolManager() const
Definition: SValBuilder.h:172
clang::ento::ConditionTruthVal
Definition: ConstraintManager.h:38
clang::ASTContext::getLangOpts
const LangOptions & getLangOpts() const
Definition: ASTContext.h:724