clang  15.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  /// Reduce cast expression by removing redundant intermediate casts.
100  /// E.g.
101  /// - (char)(short)(int x) -> (char)(int x)
102  /// - (int)(int x) -> int x
103  ///
104  /// \param V -- SymbolVal, which pressumably contains SymbolCast or any symbol
105  /// that is applicable for cast operation.
106  /// \param CastTy -- QualType, which `V` shall be cast to.
107  /// \return SVal with simplified cast expression.
108  /// \note: Currently only support integral casts.
110 
111 public:
112  SValBuilder(llvm::BumpPtrAllocator &alloc, ASTContext &context,
113  ProgramStateManager &stateMgr);
114 
115  virtual ~SValBuilder() = default;
116 
117  SVal evalCast(SVal V, QualType CastTy, QualType OriginalTy);
118 
119  // Handles casts of type CK_IntegralCast.
121  QualType originalType);
122 
123  virtual SVal evalMinus(NonLoc val) = 0;
124 
125  virtual SVal evalComplement(NonLoc val) = 0;
126 
127  /// Create a new value which represents a binary expression with two non-
128  /// location operands.
130  NonLoc lhs, NonLoc rhs, QualType resultTy) = 0;
131 
132  /// Create a new value which represents a binary expression with two memory
133  /// location operands.
135  Loc lhs, Loc rhs, QualType resultTy) = 0;
136 
137  /// Create a new value which represents a binary expression with a memory
138  /// location and non-location operands. For example, this would be used to
139  /// evaluate a pointer arithmetic operation.
141  Loc lhs, NonLoc rhs, QualType resultTy) = 0;
142 
143  /// Evaluates a given SVal. If the SVal has only one possible (integer) value,
144  /// that value is returned. Otherwise, returns NULL.
145  virtual const llvm::APSInt *getKnownValue(ProgramStateRef state, SVal val) = 0;
146 
147  /// Simplify symbolic expressions within a given SVal. Return an SVal
148  /// that represents the same value, but is hopefully easier to work with
149  /// than the original SVal.
150  virtual SVal simplifySVal(ProgramStateRef State, SVal Val) = 0;
151 
152  /// Constructs a symbolic expression for two non-location values.
154  NonLoc lhs, NonLoc rhs, QualType resultTy);
155 
157  SVal lhs, SVal rhs, QualType type);
158 
159  /// \return Whether values in \p lhs and \p rhs are equal at \p state.
161 
163 
166 
168  const ASTContext &getContext() const { return Context; }
169 
171 
173  return Context.getLangOpts().CPlusPlus ? Context.BoolTy : Context.IntTy;
174  }
175 
177  return ArrayIndexTy;
178  }
179 
182 
184  const SymbolManager &getSymbolManager() const { return SymMgr; }
185 
187  const MemRegionManager &getRegionManager() const { return MemMgr; }
188 
189  const AnalyzerOptions &getAnalyzerOptions() const { return AnOpts; }
190 
191  // Forwarding methods to SymbolManager.
192 
194  const LocationContext *LCtx,
195  QualType type,
196  unsigned visitCount,
197  const void *symbolTag = nullptr) {
198  return SymMgr.conjureSymbol(stmt, LCtx, type, visitCount, symbolTag);
199  }
200 
202  const LocationContext *LCtx,
203  unsigned visitCount,
204  const void *symbolTag = nullptr) {
205  return SymMgr.conjureSymbol(expr, LCtx, visitCount, symbolTag);
206  }
207 
208  /// Construct an SVal representing '0' for the specified type.
210 
211  /// Make a unique symbol for value of region.
213 
214  /// Create a new symbol with a unique 'name'.
215  ///
216  /// We resort to conjured symbols when we cannot construct a derived symbol.
217  /// The advantage of symbols derived/built from other symbols is that we
218  /// preserve the relation between related(or even equivalent) expressions, so
219  /// conjured symbols should be used sparingly.
220  DefinedOrUnknownSVal conjureSymbolVal(const void *symbolTag,
221  const Expr *expr,
222  const LocationContext *LCtx,
223  unsigned count);
224  DefinedOrUnknownSVal conjureSymbolVal(const void *symbolTag,
225  const Expr *expr,
226  const LocationContext *LCtx,
227  QualType type,
228  unsigned count);
230  const LocationContext *LCtx,
231  QualType type,
232  unsigned visitCount);
233 
234  /// Conjure a symbol representing heap allocated memory region.
235  ///
236  /// Note, the expression should represent a location.
238  const LocationContext *LCtx,
239  unsigned Count);
240 
241  /// Conjure a symbol representing heap allocated memory region.
242  ///
243  /// Note, now, the expression *doesn't* need to represent a location.
244  /// But the type need to!
246  const LocationContext *LCtx,
247  QualType type, unsigned Count);
248 
250  SymbolRef parentSymbol, const TypedValueRegion *region);
251 
252  DefinedSVal getMetadataSymbolVal(const void *symbolTag,
253  const MemRegion *region,
254  const Expr *expr, QualType type,
255  const LocationContext *LCtx,
256  unsigned count);
257 
259 
261 
262  DefinedSVal getBlockPointer(const BlockDecl *block, CanQualType locTy,
263  const LocationContext *locContext,
264  unsigned blockCount);
265 
266  /// Returns the value of \p E, if it can be determined in a non-path-sensitive
267  /// manner.
268  ///
269  /// If \p E is not a constant or cannot be modeled, returns \c None.
271 
272  NonLoc makeCompoundVal(QualType type, llvm::ImmutableList<SVal> vals) {
274  }
275 
277  const TypedValueRegion *region) {
279  BasicVals.getLazyCompoundValData(store, region));
280  }
281 
283  return nonloc::PointerToMember(DD);
284  }
285 
287  return nonloc::PointerToMember(PTMD);
288  }
289 
291  return nonloc::ConcreteInt(BasicVals.getValue(0, ArrayIndexTy));
292  }
293 
294  NonLoc makeArrayIndex(uint64_t idx) {
295  return nonloc::ConcreteInt(BasicVals.getValue(idx, ArrayIndexTy));
296  }
297 
299 
301  return nonloc::ConcreteInt(
302  BasicVals.getValue(integer->getValue(),
304  }
305 
307  return makeTruthVal(boolean->getValue(), boolean->getType());
308  }
309 
311 
313  return nonloc::ConcreteInt(BasicVals.getValue(integer));
314  }
315 
317  return loc::ConcreteInt(BasicVals.getValue(integer));
318  }
319 
320  NonLoc makeIntVal(const llvm::APInt& integer, bool isUnsigned) {
321  return nonloc::ConcreteInt(BasicVals.getValue(integer, isUnsigned));
322  }
323 
324  DefinedSVal makeIntVal(uint64_t integer, QualType type) {
325  if (Loc::isLocType(type))
326  return loc::ConcreteInt(BasicVals.getValue(integer, type));
327 
328  return nonloc::ConcreteInt(BasicVals.getValue(integer, type));
329  }
330 
331  NonLoc makeIntVal(uint64_t integer, bool isUnsigned) {
332  return nonloc::ConcreteInt(BasicVals.getIntValue(integer, isUnsigned));
333  }
334 
335  NonLoc makeIntValWithWidth(QualType ptrType, uint64_t integer) {
336  return nonloc::ConcreteInt(BasicVals.getValue(integer, ptrType));
337  }
338 
339  NonLoc makeLocAsInteger(Loc loc, unsigned bits) {
341  }
342 
344  const llvm::APSInt &rhs, QualType type);
345 
347  BinaryOperator::Opcode op, const SymExpr *lhs,
348  QualType type);
349 
351  const SymExpr *rhs, QualType type);
352 
353  /// Create a NonLoc value for cast.
354  nonloc::SymbolVal makeNonLoc(const SymExpr *operand, QualType fromTy,
355  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.
369  // We cannot use the `isAnyPointerType()`.
370  assert((type->isPointerType() || type->isObjCObjectPointerType() ||
371  type->isBlockPointerType() || type->isNullPtrType() ||
372  type->isReferenceType()) &&
373  "makeNullWithType must use pointer type");
374 
375  // The `sizeof(T&)` is `sizeof(T)`, thus we replace the reference with a
376  // pointer. Here we assume that references are actually implemented by
377  // pointers under-the-hood.
378  type = type->isReferenceType()
379  ? Context.getPointerType(type->getPointeeType())
380  : type;
382  }
383 
386  }
387 
389  return loc::MemRegionVal(region);
390  }
391 
393  return loc::GotoLabel(expr->getLabel());
394  }
395 
397  return loc::ConcreteInt(BasicVals.getValue(integer));
398  }
399 
400  /// Return MemRegionVal on success cast, otherwise return None.
402  QualType type);
403 
404  /// Make an SVal that represents the given symbol. This follows the convention
405  /// of representing Loc-type symbols (symbolic pointers and references)
406  /// as Loc values wrapping the symbol rather than as plain symbol values.
408  if (Loc::isLocType(Sym->getType()))
409  return makeLoc(Sym);
410  return nonloc::SymbolVal(Sym);
411  }
412 
413  /// Return a memory region for the 'this' object reference.
415  const StackFrameContext *SFC);
416 
417  /// Return a memory region for the 'this' object reference.
419  const StackFrameContext *SFC);
420 };
421 
422 SValBuilder* createSimpleSValBuilder(llvm::BumpPtrAllocator &alloc,
423  ASTContext &context,
424  ProgramStateManager &stateMgr);
425 
426 } // namespace ento
427 
428 } // namespace clang
429 
430 #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:437
clang::ento::Loc::isLocType
static bool isLocType(QualType T)
Definition: SVals.h:335
clang::ento::UndefinedVal
Definition: SVals.h:223
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:107
clang::ento::SValBuilder::getAnalyzerOptions
const AnalyzerOptions & getAnalyzerOptions() const
Definition: SValBuilder.h:189
type
clang::ento::SValBuilder::getStateManager
ProgramStateManager & getStateManager()
Definition: SValBuilder.h:170
clang::ento::SValBuilder::makeLazyCompoundVal
NonLoc makeLazyCompoundVal(const StoreRef &store, const TypedValueRegion *region)
Definition: SValBuilder.h:276
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:456
clang::ast_matchers::stmt
const internal::VariadicAllOfMatcher< Stmt > stmt
Matches statements.
Definition: ASTMatchersInternal.cpp:810
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:224
clang::ento::SValBuilder::makePointerToMember
NonLoc makePointerToMember(const PointerToMemberData *PTMD)
Definition: SValBuilder.h:286
clang::ento::NonLoc
Definition: SVals.h:304
clang::ento::SValBuilder::makeLocAsInteger
NonLoc makeLocAsInteger(Loc loc, unsigned bits)
Definition: SValBuilder.h:339
clang::ento::DefinedOrUnknownSVal
Definition: SVals.h:235
clang::ento::createSimpleSValBuilder
SValBuilder * createSimpleSValBuilder(llvm::BumpPtrAllocator &alloc, ASTContext &context, ProgramStateManager &stateMgr)
Definition: SimpleSValBuilder.cpp:79
clang::NamedDecl
This represents a decl that may have a name.
Definition: Decl.h:247
clang::ento::SValBuilder::makeNullWithType
loc::ConcreteInt makeNullWithType(QualType type)
Create NULL pointer, with proper pointer bit-width for given address space.
Definition: SValBuilder.h:368
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:675
clang::ast_matchers::type
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
Definition: ASTMatchersInternal.cpp:773
clang::ento::SValBuilder::getDerivedRegionValueSymbolVal
DefinedOrUnknownSVal getDerivedRegionValueSymbolVal(SymbolRef parentSymbol, const TypedValueRegion *region)
Definition: SValBuilder.cpp:241
ProgramState_Fwd.h
SymbolManager.h
clang::ento::SValBuilder::getArrayIndexType
QualType getArrayIndexType() const
Definition: SValBuilder.h:176
clang::ento::loc::GotoLabel
Definition: SVals.h:574
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:385
clang::ento::UnknownVal
Definition: SVals.h:256
clang::ento::BasicValueFactory::getCompoundValData
const CompoundValData * getCompoundValData(QualType T, llvm::ImmutableList< SVal > Vals)
Definition: BasicValueFactory.cpp:126
clang::ento::loc::MemRegionVal
Definition: SVals.h:598
clang::ento::loc::ConcreteInt
Definition: SVals.h:640
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::makeSymbolVal
DefinedSVal makeSymbolVal(SymbolRef Sym)
Make an SVal that represents the given symbol.
Definition: SValBuilder.h:407
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::makeIntValWithWidth
NonLoc makeIntValWithWidth(QualType ptrType, uint64_t integer)
Definition: SValBuilder.h:335
SymExpr.h
V
#define V(N, I)
Definition: ASTContext.h:3176
clang::IntegerLiteral
Definition: Expr.h:1494
clang::ast_matchers::expr
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
Definition: ASTMatchersInternal.cpp:890
clang::ento::DefinedSVal
Definition: SVals.h:268
clang::ento::SValBuilder::makeIntVal
DefinedSVal makeIntVal(uint64_t integer, QualType type)
Definition: SValBuilder.h:324
clang::ento::SValBuilder::makeLoc
loc::MemRegionVal makeLoc(const MemRegion *region)
Definition: SValBuilder.h:388
clang::ento::SValBuilder::conjureSymbol
const SymbolConjured * conjureSymbol(const Stmt *stmt, const LocationContext *LCtx, QualType type, unsigned visitCount, const void *symbolTag=nullptr)
Definition: SValBuilder.h:193
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:4201
clang::ento::SValBuilder::getRegionValueSymbolVal
DefinedOrUnknownSVal getRegionValueSymbolVal(const TypedValueRegion *region)
Make a unique symbol for value of region.
Definition: SValBuilder.cpp:131
clang::ento::SValBuilder::getContext
ASTContext & getContext()
Definition: SValBuilder.h:167
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:208
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:298
clang::ento::SymExpr
Symbolic value.
Definition: SymExpr.h:29
LangOptions.h
clang::ento::StoreRef
Definition: StoreRef.h:29
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:290
clang::ento::SValBuilder::convertToArrayIndex
SVal convertToArrayIndex(SVal val)
Definition: SValBuilder.cpp:112
clang::ento::SValBuilder::getRegionManager
MemRegionManager & getRegionManager()
Definition: SValBuilder.h:186
clang::ento::nonloc::PointerToMember
Value representing pointer-to-member.
Definition: SVals.h:524
clang::ento::SValBuilder::getContext
const ASTContext & getContext() const
Definition: SValBuilder.h:168
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:312
ASTContext.h
clang::ento::SValBuilder::getBasicValueFactory
BasicValueFactory & getBasicValueFactory()
Definition: SValBuilder.h:180
clang::ento::SValBuilder::makeLoc
loc::GotoLabel makeLoc(const AddrLabelExpr *expr)
Definition: SValBuilder.h:392
clang::ento::SValBuilder::makePointerToMember
NonLoc makePointerToMember(const DeclaratorDecl *DD)
Definition: SValBuilder.h:282
clang::ento::SValBuilder::simplifySVal
virtual SVal simplifySVal(ProgramStateRef State, SVal Val)=0
Simplify symbolic expressions within a given SVal.
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:2089
BasicValueFactory.h
clang::ento::nonloc::LazyCompoundVal
Definition: SVals.h:485
clang::ento::BasicValueFactory::getIntValue
const llvm::APSInt & getIntValue(uint64_t X, bool isUnsigned)
Definition: BasicValueFactory.h:177
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:326
clang::ento::SValBuilder::getCastedMemRegionVal
Optional< loc::MemRegionVal > getCastedMemRegionVal(const MemRegion *region, QualType type)
Return MemRegionVal on success cast, otherwise return None.
Definition: SValBuilder.cpp:291
clang::APIntStorage::getValue
llvm::APInt getValue() const
Definition: Expr.h:1478
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:412
clang::ento::SValBuilder
Definition: SValBuilder.h:53
clang::CXXRecordDecl
Represents a C++ struct/union/class.
Definition: DeclCXX.h:254
clang::ento::SValBuilder::makeCompoundVal
NonLoc makeCompoundVal(QualType type, llvm::ImmutableList< SVal > vals)
Definition: SValBuilder.h:272
clang::ento::SValBuilder::makeLoc
loc::MemRegionVal makeLoc(SymbolRef sym)
Definition: SValBuilder.h:384
clang::ento::ProgramStateManager
Definition: ProgramState.h:498
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:591
clang::ASTContext::IntTy
CanQualType IntTy
Definition: ASTContext.h:1105
clang::ento::SValBuilder::getBasicValueFactory
const BasicValueFactory & getBasicValueFactory() const
Definition: SValBuilder.h:181
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::makeIntVal
NonLoc makeIntVal(const llvm::APInt &integer, bool isUnsigned)
Definition: SValBuilder.h:320
clang::DeclaratorDecl
Represents a ValueDecl that came out of a declarator.
Definition: Decl.h:726
clang::AddrLabelExpr
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:4304
clang::ento::SValBuilder::makeIntVal
nonloc::ConcreteInt makeIntVal(const IntegerLiteral *integer)
Definition: SValBuilder.h:300
clang::ento::SValBuilder::makeIntLocVal
loc::ConcreteInt makeIntLocVal(const llvm::APSInt &integer)
Definition: SValBuilder.h:316
clang::ento::SValBuilder::getSymbolManager
const SymbolManager & getSymbolManager() const
Definition: SValBuilder.h:184
LLVM.h
clang::AnalyzerOptions
Stores options for the analyzer from the command line.
Definition: AnalyzerOptions.h:165
State
LineState State
Definition: UnwrappedLineFormatter.cpp:1090
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:312
clang::ento::SValBuilder::getFunctionPointer
DefinedSVal getFunctionPointer(const FunctionDecl *func)
Definition: SValBuilder.cpp:275
clang::ento::SValBuilder::makeIntVal
NonLoc makeIntVal(uint64_t integer, bool isUnsigned)
Definition: SValBuilder.h:331
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:201
clang::ento::SValBuilder::getBlockPointer
DefinedSVal getBlockPointer(const BlockDecl *block, CanQualType locTy, const LocationContext *locContext, unsigned blockCount)
Definition: SValBuilder.cpp:279
clang::ento::SValBuilder::getRegionManager
const MemRegionManager & getRegionManager() const
Definition: SValBuilder.h:187
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::MemRegionManager
Definition: MemRegion.h:1303
clang::ento::SValBuilder::makeLoc
loc::ConcreteInt makeLoc(const llvm::APSInt &integer)
Definition: SValBuilder.h:396
clang::ento::nonloc::SymbolVal
Represents symbolic expression that isn't a location.
Definition: SVals.h:355
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:488
clang::ento::SValBuilder::~SValBuilder
virtual ~SValBuilder()=default
clang::ento::SValBuilder::evalMinus
virtual SVal evalMinus(NonLoc val)=0
clang::ento::nonloc::LocAsInteger
Definition: SVals.h:416
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:540
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:673
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:306
clang::ento::SValBuilder::simplifySymbolCast
nonloc::SymbolVal simplifySymbolCast(nonloc::SymbolVal V, QualType CastTy)
Reduce cast expression by removing redundant intermediate casts.
Definition: SValBuilder.cpp:1014
clang::ento::SValBuilder::getSymbolManager
SymbolManager & getSymbolManager()
Definition: SValBuilder.h:183
clang::ento::SValBuilder::evalCastKind
SVal evalCastKind(UndefinedVal V, QualType CastTy, QualType OriginalTy)
Definition: SValBuilder.cpp:628
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:294
clang::ASTContext::getPointerType
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
Definition: ASTContext.cpp:3260
clang::ento::PointerToMemberData
Definition: BasicValueFactory.h:82
clang::ento::SVal
SVal - This represents a symbolic expression, which can be either an L-value or an R-value.
Definition: SVals.h:74
clang::ento::SValBuilder::makeNonLoc
nonloc::SymbolVal makeNonLoc(const SymExpr *lhs, BinaryOperator::Opcode op, const llvm::APSInt &rhs, QualType type)
Definition: SValBuilder.cpp:77
clang::ento::TypedValueRegion
TypedValueRegion - An abstract class representing regions having a typed value.
Definition: MemRegion.h:522
clang::ento::MemRegionManager::getSymbolicRegion
const SymbolicRegion * getSymbolicRegion(SymbolRef Sym, const MemSpaceRegion *MemSpace=nullptr)
Retrieve or create a "symbolic" memory region.
Definition: MemRegion.cpp:1159
clang::ento::SValBuilder::evalEQ
SVal evalEQ(ProgramStateRef state, SVal lhs, SVal rhs)
Definition: SValBuilder.cpp:493
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:172
clang::ento::SValBuilder::getMemberPointer
DefinedSVal getMemberPointer(const NamedDecl *ND)
Definition: SValBuilder.cpp:259
clang::ASTContext::BoolTy
CanQualType BoolTy
Definition: ASTContext.h:1097
clang::FunctionDecl
Represents a function declaration or definition.
Definition: Decl.h:1872
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:218
clang::ASTContext::getLangOpts
const LangOptions & getLangOpts() const
Definition: ASTContext.h:786
llvm::IntrusiveRefCntPtr< const ProgramState >
clang::CXXMethodDecl
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:1968
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:223