clang 8.0.0

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