clang  14.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"
19 #include "clang/AST/Expr.h"
20 #include "clang/AST/ExprObjC.h"
21 #include "clang/AST/Type.h"
22 #include "clang/Basic/LLVM.h"
30 #include "llvm/ADT/ImmutableList.h"
31 #include "llvm/ADT/Optional.h"
32 #include <cstdint>
33 
34 namespace clang {
35 
36 class AnalyzerOptions;
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:
58 
59  /// Manager of APSInt values.
61 
62  /// Manages the creation of symbols.
64 
65  /// Manages the creation of memory regions.
67 
69 
71 
72  /// The scalar type to use for array indices.
74 
75  /// The width of the scalar type used for array indices.
76  const unsigned ArrayIndexWidth;
77 
78  SVal evalCastKind(UndefinedVal V, QualType CastTy, QualType OriginalTy);
79  SVal evalCastKind(UnknownVal V, QualType CastTy, QualType OriginalTy);
80  SVal evalCastKind(Loc V, QualType CastTy, QualType OriginalTy);
81  SVal evalCastKind(NonLoc V, QualType CastTy, QualType OriginalTy);
83  QualType OriginalTy);
86  QualType OriginalTy);
88  QualType OriginalTy);
90  QualType OriginalTy);
92  QualType OriginalTy);
94  QualType OriginalTy);
96  QualType OriginalTy);
98  QualType OriginalTy);
99 
100 public:
101  SValBuilder(llvm::BumpPtrAllocator &alloc, ASTContext &context,
102  ProgramStateManager &stateMgr);
103 
104  virtual ~SValBuilder() = default;
105 
106  bool haveSameType(const SymExpr *Sym1, const SymExpr *Sym2) {
107  return haveSameType(Sym1->getType(), Sym2->getType());
108  }
109 
110  bool haveSameType(QualType Ty1, QualType Ty2) {
111  // FIXME: Remove the second disjunct when we support symbolic
112  // truncation/extension.
113  return (Context.getCanonicalType(Ty1) == Context.getCanonicalType(Ty2) ||
114  (Ty1->isIntegralOrEnumerationType() &&
116  }
117 
118  SVal evalCast(SVal V, QualType CastTy, QualType OriginalTy);
119 
120  // Handles casts of type CK_IntegralCast.
122  QualType originalType);
123 
124  virtual SVal evalMinus(NonLoc val) = 0;
125 
126  virtual SVal evalComplement(NonLoc val) = 0;
127 
128  /// Create a new value which represents a binary expression with two non-
129  /// location operands.
131  NonLoc lhs, NonLoc rhs, QualType resultTy) = 0;
132 
133  /// Create a new value which represents a binary expression with two memory
134  /// location operands.
136  Loc lhs, Loc rhs, QualType resultTy) = 0;
137 
138  /// Create a new value which represents a binary expression with a memory
139  /// location and non-location operands. For example, this would be used to
140  /// evaluate a pointer arithmetic operation.
142  Loc lhs, NonLoc rhs, QualType resultTy) = 0;
143 
144  /// Evaluates a given SVal. If the SVal has only one possible (integer) value,
145  /// that value is returned. Otherwise, returns NULL.
146  virtual const llvm::APSInt *getKnownValue(ProgramStateRef state, SVal val) = 0;
147 
148  /// Simplify symbolic expressions within a given SVal. Return an SVal
149  /// that represents the same value, but is hopefully easier to work with
150  /// than the original SVal.
151  virtual SVal simplifySVal(ProgramStateRef State, SVal Val) = 0;
152 
153  /// Constructs a symbolic expression for two non-location values.
155  NonLoc lhs, NonLoc rhs, QualType resultTy);
156 
158  SVal lhs, SVal rhs, QualType type);
159 
160  /// \return Whether values in \p lhs and \p rhs are equal at \p state.
162 
164 
167 
169  const ASTContext &getContext() const { return Context; }
170 
172 
174  return Context.getLangOpts().CPlusPlus ? Context.BoolTy : Context.IntTy;
175  }
176 
178  return ArrayIndexTy;
179  }
180 
183 
185  const SymbolManager &getSymbolManager() const { return SymMgr; }
186 
188  const MemRegionManager &getRegionManager() const { return MemMgr; }
189 
190  const AnalyzerOptions &getAnalyzerOptions() const { return AnOpts; }
191 
192  // Forwarding methods to SymbolManager.
193 
195  const LocationContext *LCtx,
196  QualType type,
197  unsigned visitCount,
198  const void *symbolTag = nullptr) {
199  return SymMgr.conjureSymbol(stmt, LCtx, type, visitCount, symbolTag);
200  }
201 
203  const LocationContext *LCtx,
204  unsigned visitCount,
205  const void *symbolTag = nullptr) {
206  return SymMgr.conjureSymbol(expr, LCtx, visitCount, symbolTag);
207  }
208 
209  /// Construct an SVal representing '0' for the specified type.
211 
212  /// Make a unique symbol for value of region.
214 
215  /// Create a new symbol with a unique 'name'.
216  ///
217  /// We resort to conjured symbols when we cannot construct a derived symbol.
218  /// The advantage of symbols derived/built from other symbols is that we
219  /// preserve the relation between related(or even equivalent) expressions, so
220  /// conjured symbols should be used sparingly.
221  DefinedOrUnknownSVal conjureSymbolVal(const void *symbolTag,
222  const Expr *expr,
223  const LocationContext *LCtx,
224  unsigned count);
225  DefinedOrUnknownSVal conjureSymbolVal(const void *symbolTag,
226  const Expr *expr,
227  const LocationContext *LCtx,
228  QualType type,
229  unsigned count);
231  const LocationContext *LCtx,
232  QualType type,
233  unsigned visitCount);
234 
235  /// Conjure a symbol representing heap allocated memory region.
236  ///
237  /// Note, the expression should represent a location.
239  const LocationContext *LCtx,
240  unsigned Count);
241 
242  /// Conjure a symbol representing heap allocated memory region.
243  ///
244  /// Note, now, the expression *doesn't* need to represent a location.
245  /// But the type need to!
247  const LocationContext *LCtx,
248  QualType type, unsigned Count);
249 
251  SymbolRef parentSymbol, const TypedValueRegion *region);
252 
253  DefinedSVal getMetadataSymbolVal(const void *symbolTag,
254  const MemRegion *region,
255  const Expr *expr, QualType type,
256  const LocationContext *LCtx,
257  unsigned count);
258 
260 
262 
263  DefinedSVal getBlockPointer(const BlockDecl *block, CanQualType locTy,
264  const LocationContext *locContext,
265  unsigned blockCount);
266 
267  /// Returns the value of \p E, if it can be determined in a non-path-sensitive
268  /// manner.
269  ///
270  /// If \p E is not a constant or cannot be modeled, returns \c None.
272 
273  NonLoc makeCompoundVal(QualType type, llvm::ImmutableList<SVal> vals) {
275  }
276 
278  const TypedValueRegion *region) {
280  BasicVals.getLazyCompoundValData(store, region));
281  }
282 
284  return nonloc::PointerToMember(DD);
285  }
286 
288  return nonloc::PointerToMember(PTMD);
289  }
290 
292  return nonloc::ConcreteInt(BasicVals.getValue(0, ArrayIndexTy));
293  }
294 
295  NonLoc makeArrayIndex(uint64_t idx) {
296  return nonloc::ConcreteInt(BasicVals.getValue(idx, ArrayIndexTy));
297  }
298 
300 
302  return nonloc::ConcreteInt(
303  BasicVals.getValue(integer->getValue(),
305  }
306 
308  return makeTruthVal(boolean->getValue(), boolean->getType());
309  }
310 
312 
314  return nonloc::ConcreteInt(BasicVals.getValue(integer));
315  }
316 
318  return loc::ConcreteInt(BasicVals.getValue(integer));
319  }
320 
321  NonLoc makeIntVal(const llvm::APInt& integer, bool isUnsigned) {
322  return nonloc::ConcreteInt(BasicVals.getValue(integer, isUnsigned));
323  }
324 
325  DefinedSVal makeIntVal(uint64_t integer, QualType type) {
326  if (Loc::isLocType(type))
327  return loc::ConcreteInt(BasicVals.getValue(integer, type));
328 
329  return nonloc::ConcreteInt(BasicVals.getValue(integer, type));
330  }
331 
332  NonLoc makeIntVal(uint64_t integer, bool isUnsigned) {
333  return nonloc::ConcreteInt(BasicVals.getIntValue(integer, isUnsigned));
334  }
335 
336  NonLoc makeIntValWithPtrWidth(uint64_t integer, bool isUnsigned) {
337  return nonloc::ConcreteInt(
338  BasicVals.getIntWithPtrWidth(integer, isUnsigned));
339  }
340 
341  NonLoc makeLocAsInteger(Loc loc, unsigned bits) {
343  }
344 
346  const llvm::APSInt& rhs, QualType type);
347 
349  const SymExpr *lhs, QualType type);
350 
352  const SymExpr *rhs, QualType type);
353 
354  /// Create a NonLoc value for cast.
355  NonLoc makeNonLoc(const SymExpr *operand, QualType fromTy, QualType toTy);
356 
359  }
360 
363  }
364 
365  /// Create NULL pointer, with proper pointer bit-width for given address
366  /// space.
367  /// \param type pointer type.
370  }
371 
374  }
375 
378  }
379 
380  Loc makeLoc(const MemRegion* region) {
381  return loc::MemRegionVal(region);
382  }
383 
385  return loc::GotoLabel(expr->getLabel());
386  }
387 
388  Loc makeLoc(const llvm::APSInt& integer) {
389  return loc::ConcreteInt(BasicVals.getValue(integer));
390  }
391 
392  /// Return MemRegionVal on success cast, otherwise return None.
394  QualType type);
395 
396  /// Make an SVal that represents the given symbol. This follows the convention
397  /// of representing Loc-type symbols (symbolic pointers and references)
398  /// as Loc values wrapping the symbol rather than as plain symbol values.
400  if (Loc::isLocType(Sym->getType()))
401  return makeLoc(Sym);
402  return nonloc::SymbolVal(Sym);
403  }
404 
405  /// Return a memory region for the 'this' object reference.
407  const StackFrameContext *SFC);
408 
409  /// Return a memory region for the 'this' object reference.
411  const StackFrameContext *SFC);
412 };
413 
414 SValBuilder* createSimpleSValBuilder(llvm::BumpPtrAllocator &alloc,
415  ASTContext &context,
416  ProgramStateManager &stateMgr);
417 
418 } // namespace ento
419 
420 } // namespace clang
421 
422 #endif // LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SVALBUILDER_H
clang::ento::BasicValueFactory::getPersistentSValWithData
const std::pair< SVal, uintptr_t > & getPersistentSValWithData(const SVal &V, uintptr_t Data)
Definition: BasicValueFactory.cpp:345
clang::ento::SValBuilder::evalBinOp
SVal evalBinOp(ProgramStateRef state, BinaryOperator::Opcode op, SVal lhs, SVal rhs, QualType type)
Definition: SValBuilder.cpp:434
clang::ento::Loc::isLocType
static bool isLocType(QualType T)
Definition: SVals.h:336
clang::ento::UndefinedVal
Definition: SVals.h:224
clang::CXXBoolLiteralExpr
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition: ExprCXX.h:721
clang::interp::APInt
llvm::APInt APInt
Definition: Integral.h:27
clang::ento::SymbolManager::conjureSymbol
const SymbolConjured * conjureSymbol(const Stmt *E, const LocationContext *LCtx, QualType T, unsigned VisitCount, const void *SymbolTag=nullptr)
clang::ento::BasicValueFactory
Definition: BasicValueFactory.h:108
clang::ento::SValBuilder::makeLoc
Loc makeLoc(const MemRegion *region)
Definition: SValBuilder.h:380
clang::ento::SValBuilder::getAnalyzerOptions
const AnalyzerOptions & getAnalyzerOptions() const
Definition: SValBuilder.h:190
type
clang::ento::SValBuilder::getStateManager
ProgramStateManager & getStateManager()
Definition: SValBuilder.h:171
clang::ento::SValBuilder::makeLazyCompoundVal
NonLoc makeLazyCompoundVal(const StoreRef &store, const TypedValueRegion *region)
Definition: SValBuilder.h:277
clang::LocationContext
It wraps the AnalysisDeclContext to represent both the call stack with the help of StackFrameContext ...
Definition: AnalysisDeclContext.h:215
SVals.h
clang::ento::nonloc::CompoundVal
Definition: SVals.h:464
clang::ast_matchers::stmt
const internal::VariadicAllOfMatcher< Stmt > stmt
Matches statements.
Definition: ASTMatchersInternal.cpp:809
clang::ento::SValBuilder::StateMgr
ProgramStateManager & StateMgr
Definition: SValBuilder.h:68
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:221
clang::ento::SValBuilder::makePointerToMember
NonLoc makePointerToMember(const PointerToMemberData *PTMD)
Definition: SValBuilder.h:287
clang::ento::NonLoc
Definition: SVals.h:305
clang::ento::SValBuilder::makeLocAsInteger
NonLoc makeLocAsInteger(Loc loc, unsigned bits)
Definition: SValBuilder.h:341
clang::ento::DefinedOrUnknownSVal
Definition: SVals.h:236
clang::ento::createSimpleSValBuilder
SValBuilder * createSimpleSValBuilder(llvm::BumpPtrAllocator &alloc, ASTContext &context, ProgramStateManager &stateMgr)
Definition: SimpleSValBuilder.cpp:52
clang::NamedDecl
This represents a decl that may have a name.
Definition: Decl.h:249
clang::ento::SValBuilder::makeSymbolVal
SVal makeSymbolVal(SymbolRef Sym)
Make an SVal that represents the given symbol.
Definition: SValBuilder.h:399
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:673
clang::ento::SValBuilder::getDerivedRegionValueSymbolVal
DefinedOrUnknownSVal getDerivedRegionValueSymbolVal(SymbolRef parentSymbol, const TypedValueRegion *region)
Definition: SValBuilder.cpp:238
ProgramState_Fwd.h
SymbolManager.h
clang::ento::SValBuilder::getArrayIndexType
QualType getArrayIndexType() const
Definition: SValBuilder.h:177
clang::ento::loc::GotoLabel
Definition: SVals.h:582
llvm::Optional
Definition: LLVM.h:40
clang::ento::SValBuilder::makeZeroVal
DefinedOrUnknownSVal makeZeroVal(QualType type)
Construct an SVal representing '0' for the specified type.
Definition: SValBuilder.cpp:62
clang::StackFrameContext
It represents a stack frame of the call stack (based on CallEvent).
Definition: AnalysisDeclContext.h:295
clang::ento::nonloc::ConcreteInt
Value representing integer constant.
Definition: SVals.h:386
clang::ento::UnknownVal
Definition: SVals.h:257
clang::ento::BasicValueFactory::getCompoundValData
const CompoundValData * getCompoundValData(QualType T, llvm::ImmutableList< SVal > Vals)
Definition: BasicValueFactory.cpp:126
clang::ento::loc::MemRegionVal
Definition: SVals.h:606
clang::ento::loc::ConcreteInt
Definition: SVals.h:648
clang::ento::SValBuilder::getConjuredHeapSymbolVal
DefinedOrUnknownSVal getConjuredHeapSymbolVal(const Expr *E, const LocationContext *LCtx, unsigned Count)
Conjure a symbol representing heap allocated memory region.
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:77
b
__device__ __2f16 b
Definition: __clang_hip_libdevice_declares.h:314
clang::ento::SValBuilder::getKnownValue
virtual const llvm::APSInt * getKnownValue(ProgramStateRef state, SVal val)=0
Evaluates a given SVal.
clang::ento::SValBuilder::haveSameType
bool haveSameType(const SymExpr *Sym1, const SymExpr *Sym2)
Definition: SValBuilder.h:106
clang::ObjCBoolLiteralExpr
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition: ExprObjC.h:88
clang::ento::MemRegion
MemRegion - The root abstract class for all memory regions.
Definition: MemRegion.h:94
clang::ento::ConditionTruthVal
Definition: ConstraintManager.h:38
APSInt
llvm::APSInt APSInt
Definition: ByteCodeEmitter.cpp:19
clang::ento::SValBuilder::makeNonLoc
NonLoc makeNonLoc(const SymExpr *lhs, BinaryOperator::Opcode op, const llvm::APSInt &rhs, QualType type)
Definition: SValBuilder.cpp:77
SymExpr.h
V
#define V(N, I)
Definition: ASTContext.h:3121
clang::IntegerLiteral
Definition: Expr.h:1488
clang::ast_matchers::expr
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
Definition: ASTMatchersInternal.cpp:889
clang::ento::DefinedSVal
Definition: SVals.h:269
clang::ento::SValBuilder::makeIntVal
DefinedSVal makeIntVal(uint64_t integer, QualType type)
Definition: SValBuilder.h:325
clang::ento::SValBuilder::conjureSymbol
const SymbolConjured * conjureSymbol(const Stmt *stmt, const LocationContext *LCtx, QualType type, unsigned visitCount, const void *symbolTag=nullptr)
Definition: SValBuilder.h:194
clang::ento::SValBuilder::AnOpts
const AnalyzerOptions & AnOpts
Definition: SValBuilder.h:70
clang::ento::SymExpr::getType
virtual QualType getType() const =0
clang::BlockDecl
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:4153
clang::ento::SValBuilder::getRegionValueSymbolVal
DefinedOrUnknownSVal getRegionValueSymbolVal(const TypedValueRegion *region)
Make a unique symbol for value of region.
Definition: SValBuilder.cpp:128
clang::ento::SValBuilder::getContext
ASTContext & getContext()
Definition: SValBuilder.h:168
clang::ento::SValBuilder::Context
ASTContext & Context
Definition: SValBuilder.h:57
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:212
clang::ento::SValBuilder::getCXXThis
loc::MemRegionVal getCXXThis(const CXXMethodDecl *D, const StackFrameContext *SFC)
Return a memory region for the 'this' object reference.
Definition: SValBuilder.cpp:295
clang::ento::SValBuilder::haveSameType
bool haveSameType(QualType Ty1, QualType Ty2)
Definition: SValBuilder.h:110
clang::ento::SymExpr
Symbolic value.
Definition: SymExpr.h:29
LangOptions.h
clang::ento::StoreRef
Definition: StoreRef.h:29
clang::ento::SValBuilder::makeNullWithType
Loc makeNullWithType(QualType type)
Create NULL pointer, with proper pointer bit-width for given address space.
Definition: SValBuilder.h:368
clang::ento::SValBuilder::SValBuilder
SValBuilder(llvm::BumpPtrAllocator &alloc, ASTContext &context, ProgramStateManager &stateMgr)
Definition: SValBuilder.cpp:52
clang::ento::SValBuilder::makeZeroArrayIndex
NonLoc makeZeroArrayIndex()
Definition: SValBuilder.h:291
clang::ento::SValBuilder::convertToArrayIndex
SVal convertToArrayIndex(SVal val)
Definition: SValBuilder.cpp:109
clang::ento::SValBuilder::getRegionManager
MemRegionManager & getRegionManager()
Definition: SValBuilder.h:187
clang::ento::nonloc::PointerToMember
Value representing pointer-to-member.
Definition: SVals.h:532
clang::ento::SValBuilder::getContext
const ASTContext & getContext() const
Definition: SValBuilder.h:169
Type.h
Expr.h
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:309
ASTContext.h
clang::ento::SValBuilder::getBasicValueFactory
BasicValueFactory & getBasicValueFactory()
Definition: SValBuilder.h:181
clang::ASTContext::getCanonicalType
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
Definition: ASTContext.h:2468
clang::ento::SValBuilder::makePointerToMember
NonLoc makePointerToMember(const DeclaratorDecl *DD)
Definition: SValBuilder.h:283
clang::ento::SValBuilder::simplifySVal
virtual SVal simplifySVal(ProgramStateRef State, SVal Val)=0
Simplify symbolic expressions within a given SVal.
clang::ento::SValBuilder::makeLoc
Loc makeLoc(const llvm::APSInt &integer)
Definition: SValBuilder.h:388
ExprObjC.h
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::CanQual< Type >
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:2079
BasicValueFactory.h
clang::ento::nonloc::LazyCompoundVal
Definition: SVals.h:493
clang::ento::BasicValueFactory::getIntValue
const llvm::APSInt & getIntValue(uint64_t X, bool isUnsigned)
Definition: BasicValueFactory.h:178
clang::prec::PointerToMember
@ PointerToMember
Definition: OperatorPrecedence.h:42
state
and static some checkers Checker The latter are built on top of the former via the Checker and CheckerVisitor and attempts to isolate them from much of the gore of the internal analysis the analyzer is basically a source code simulator that traces out possible paths of execution The state of the and the combination of state and program point is a node in an exploded which has the entry program point and initial state
Definition: README.txt:30
clang::ento::Loc
Definition: SVals.h:327
clang::ento::SValBuilder::getCastedMemRegionVal
Optional< loc::MemRegionVal > getCastedMemRegionVal(const MemRegion *region, QualType type)
Return MemRegionVal on success cast, otherwise return None.
Definition: SValBuilder.cpp:288
clang::APIntStorage::getValue
llvm::APInt getValue() const
Definition: Expr.h:1472
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:409
clang::ento::BasicValueFactory::getIntWithPtrWidth
const llvm::APSInt & getIntWithPtrWidth(uint64_t X, bool isUnsigned)
Definition: BasicValueFactory.h:228
clang::ento::SValBuilder
Definition: SValBuilder.h:53
clang::CXXRecordDecl
Represents a C++ struct/union/class.
Definition: DeclCXX.h:255
clang::ento::SValBuilder::makeCompoundVal
NonLoc makeCompoundVal(QualType type, llvm::ImmutableList< SVal > vals)
Definition: SValBuilder.h:273
clang::ento::MemRegionManager::getSymbolicRegion
const SymbolicRegion * getSymbolicRegion(SymbolRef Sym)
Retrieve or create a "symbolic" memory region.
Definition: MemRegion.cpp:1157
clang::ento::ProgramStateManager
Definition: ProgramState.h:463
clang::ento::SValBuilder::evalCast
SVal evalCast(SVal V, QualType CastTy, QualType OriginalTy)
Cast a given SVal to another SVal using given QualType's.
Definition: SValBuilder.cpp:579
clang::ASTContext::IntTy
CanQualType IntTy
Definition: ASTContext.h:1084
clang::ento::SValBuilder::makeNull
Loc makeNull()
Definition: SValBuilder.h:372
clang::ento::SValBuilder::getBasicValueFactory
const BasicValueFactory & getBasicValueFactory() const
Definition: SValBuilder.h:182
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::makeIntValWithPtrWidth
NonLoc makeIntValWithPtrWidth(uint64_t integer, bool isUnsigned)
Definition: SValBuilder.h:336
clang::ento::SValBuilder::makeIntVal
NonLoc makeIntVal(const llvm::APInt &integer, bool isUnsigned)
Definition: SValBuilder.h:321
clang::DeclaratorDecl
Represents a ValueDecl that came out of a declarator.
Definition: Decl.h:728
clang::AddrLabelExpr
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:4300
clang::ento::SValBuilder::makeIntVal
nonloc::ConcreteInt makeIntVal(const IntegerLiteral *integer)
Definition: SValBuilder.h:301
clang::ento::SValBuilder::makeIntLocVal
loc::ConcreteInt makeIntLocVal(const llvm::APSInt &integer)
Definition: SValBuilder.h:317
clang::ento::SValBuilder::getSymbolManager
const SymbolManager & getSymbolManager() const
Definition: SValBuilder.h:185
LLVM.h
clang::AnalyzerOptions
Stores options for the analyzer from the command line.
Definition: AnalyzerOptions.h:163
State
LineState State
Definition: UnwrappedLineFormatter.cpp:986
clang::ento::BasicValueFactory::getLazyCompoundValData
const LazyCompoundValData * getLazyCompoundValData(const StoreRef &store, const TypedValueRegion *region)
Definition: BasicValueFactory.cpp:144
clang::ento::SValBuilder::makeIntVal
nonloc::ConcreteInt makeIntVal(const llvm::APSInt &integer)
Definition: SValBuilder.h:313
clang::ento::SValBuilder::getFunctionPointer
DefinedSVal getFunctionPointer(const FunctionDecl *func)
Definition: SValBuilder.cpp:272
clang::ento::SValBuilder::makeIntVal
NonLoc makeIntVal(uint64_t integer, bool isUnsigned)
Definition: SValBuilder.h:332
clang::BinaryOperatorKind
BinaryOperatorKind
Definition: OperationKinds.h:25
clang::ento::SValBuilder::conjureSymbol
const SymbolConjured * conjureSymbol(const Expr *expr, const LocationContext *LCtx, unsigned visitCount, const void *symbolTag=nullptr)
Definition: SValBuilder.h:202
clang::ento::SValBuilder::getBlockPointer
DefinedSVal getBlockPointer(const BlockDecl *block, CanQualType locTy, const LocationContext *locContext, unsigned blockCount)
Definition: SValBuilder.cpp:276
clang::ento::BasicValueFactory::getZeroWithPtrWidth
const llvm::APSInt & getZeroWithPtrWidth(bool isUnsigned=true)
Definition: BasicValueFactory.h:224
clang::ento::SValBuilder::getRegionManager
const MemRegionManager & getRegionManager() const
Definition: SValBuilder.h:188
clang::ento::SValBuilder::ArrayIndexWidth
const unsigned ArrayIndexWidth
The width of the scalar type used for array indices.
Definition: SValBuilder.h:76
clang::ento::SValBuilder::evalComplement
virtual SVal evalComplement(NonLoc val)=0
clang::ento::SValBuilder::makeLoc
Loc makeLoc(const AddrLabelExpr *expr)
Definition: SValBuilder.h:384
clang::ento::MemRegionManager
Definition: MemRegion.h:1302
clang::ento::nonloc::SymbolVal
Represents symbolic expression that isn't a location.
Definition: SVals.h:356
clang::ento::SValBuilder::makeTruthVal
nonloc::ConcreteInt makeTruthVal(bool b, QualType type)
Definition: SValBuilder.h:357
DeclarationName.h
clang::ento::SValBuilder::areEqual
ConditionTruthVal areEqual(ProgramStateRef state, SVal lhs, SVal rhs)
Definition: SValBuilder.cpp:475
clang::ento::SValBuilder::~SValBuilder
virtual ~SValBuilder()=default
clang::ento::SValBuilder::evalMinus
virtual SVal evalMinus(NonLoc val)=0
clang::ento::nonloc::LocAsInteger
Definition: SVals.h:417
clang
Definition: CalledOnceCheck.h:17
clang::Stmt
Stmt - This represents one statement.
Definition: Stmt.h:69
clang::ento::SValBuilder::evalIntegralCast
SVal evalIntegralCast(ProgramStateRef state, SVal val, QualType castTy, QualType originalType)
Definition: SValBuilder.cpp:527
clang::ento::SValBuilder::BasicVals
BasicValueFactory BasicVals
Manager of APSInt values.
Definition: SValBuilder.h:60
clang::ento::SValBuilder::evalCastSubKind
SVal evalCastSubKind(loc::ConcreteInt V, QualType CastTy, QualType OriginalTy)
Definition: SValBuilder.cpp:661
MemRegion.h
clang::Expr::getType
QualType getType() const
Definition: Expr.h:141
clang::ento::SValBuilder::makeBoolVal
nonloc::ConcreteInt makeBoolVal(const ObjCBoolLiteralExpr *boolean)
Definition: SValBuilder.h:307
clang::ento::SValBuilder::getSymbolManager
SymbolManager & getSymbolManager()
Definition: SValBuilder.h:184
clang::ento::SValBuilder::evalCastKind
SVal evalCastKind(UndefinedVal V, QualType CastTy, QualType OriginalTy)
Definition: SValBuilder.cpp:616
clang::ento::SValBuilder::SymMgr
SymbolManager SymMgr
Manages the creation of symbols.
Definition: SValBuilder.h:63
clang::ento::SValBuilder::ArrayIndexTy
const QualType ArrayIndexTy
The scalar type to use for array indices.
Definition: SValBuilder.h:73
clang::ObjCBoolLiteralExpr::getValue
bool getValue() const
Definition: ExprObjC.h:101
clang::ento::SValBuilder::makeArrayIndex
NonLoc makeArrayIndex(uint64_t idx)
Definition: SValBuilder.h:295
clang::ento::PointerToMemberData
Definition: BasicValueFactory.h:83
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::ento::TypedValueRegion
TypedValueRegion - An abstract class representing regions having a typed value.
Definition: MemRegion.h:522
clang::ento::SValBuilder::evalEQ
SVal evalEQ(ProgramStateRef state, SVal lhs, SVal rhs)
Definition: SValBuilder.cpp:480
clang::Expr
This represents one expression.
Definition: Expr.h:109
clang::ento::SValBuilder::makeTruthVal
nonloc::ConcreteInt makeTruthVal(bool b)
Definition: SValBuilder.h:361
clang::ento::SValBuilder::conjureSymbolVal
DefinedOrUnknownSVal conjureSymbolVal(const void *symbolTag, const Expr *expr, const LocationContext *LCtx, unsigned count)
Create a new symbol with a unique 'name'.
clang::ento::SValBuilder::getConditionType
QualType getConditionType() const
Definition: SValBuilder.h:173
clang::ento::SValBuilder::getMemberPointer
DefinedSVal getMemberPointer(const NamedDecl *ND)
Definition: SValBuilder.cpp:256
clang::ASTContext::BoolTy
CanQualType BoolTy
Definition: ASTContext.h:1076
clang::FunctionDecl
Represents a function declaration or definition.
Definition: Decl.h:1856
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::SymbolManager
Definition: SymbolManager.h:417
clang::ento::BasicValueFactory::getZeroWithTypeSize
const llvm::APSInt & getZeroWithTypeSize(QualType T)
Definition: BasicValueFactory.h:219
clang::ASTContext::getLangOpts
const LangOptions & getLangOpts() const
Definition: ASTContext.h:765
llvm::IntrusiveRefCntPtr
Definition: LLVM.h:47
clang::Type::isIntegralOrEnumerationType
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
Definition: Type.h:7058
clang::ento::SValBuilder::makeLoc
Loc makeLoc(SymbolRef sym)
Definition: SValBuilder.h:376
clang::CXXMethodDecl
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:1948
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:232