clang  16.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 public:
79  SValBuilder(llvm::BumpPtrAllocator &alloc, ASTContext &context,
80  ProgramStateManager &stateMgr);
81 
82  virtual ~SValBuilder() = default;
83 
84  SVal evalCast(SVal V, QualType CastTy, QualType OriginalTy);
85 
86  // Handles casts of type CK_IntegralCast.
88  QualType originalType);
89 
90  SVal evalMinus(NonLoc val);
92 
93  /// Create a new value which represents a binary expression with two non-
94  /// location operands.
96  NonLoc lhs, NonLoc rhs, QualType resultTy) = 0;
97 
98  /// Create a new value which represents a binary expression with two memory
99  /// location operands.
101  Loc lhs, Loc rhs, QualType resultTy) = 0;
102 
103  /// Create a new value which represents a binary expression with a memory
104  /// location and non-location operands. For example, this would be used to
105  /// evaluate a pointer arithmetic operation.
107  Loc lhs, NonLoc rhs, QualType resultTy) = 0;
108 
109  /// Evaluates a given SVal. If the SVal has only one possible (integer) value,
110  /// that value is returned. Otherwise, returns NULL.
111  virtual const llvm::APSInt *getKnownValue(ProgramStateRef state, SVal val) = 0;
112 
113  /// Simplify symbolic expressions within a given SVal. Return an SVal
114  /// that represents the same value, but is hopefully easier to work with
115  /// than the original SVal.
116  virtual SVal simplifySVal(ProgramStateRef State, SVal Val) = 0;
117 
118  /// Constructs a symbolic expression for two non-location values.
120  NonLoc lhs, NonLoc rhs, QualType resultTy);
121 
123  SVal operand, QualType type);
124 
126  SVal lhs, SVal rhs, QualType type);
127 
128  /// \return Whether values in \p lhs and \p rhs are equal at \p state.
130 
132 
135 
137  const ASTContext &getContext() const { return Context; }
138 
140 
142  return Context.getLangOpts().CPlusPlus ? Context.BoolTy : Context.IntTy;
143  }
144 
146  return ArrayIndexTy;
147  }
148 
151 
153  const SymbolManager &getSymbolManager() const { return SymMgr; }
154 
156  const MemRegionManager &getRegionManager() const { return MemMgr; }
157 
158  const AnalyzerOptions &getAnalyzerOptions() const { return AnOpts; }
159 
160  // Forwarding methods to SymbolManager.
161 
163  const LocationContext *LCtx,
164  QualType type,
165  unsigned visitCount,
166  const void *symbolTag = nullptr) {
167  return SymMgr.conjureSymbol(stmt, LCtx, type, visitCount, symbolTag);
168  }
169 
171  const LocationContext *LCtx,
172  unsigned visitCount,
173  const void *symbolTag = nullptr) {
174  return SymMgr.conjureSymbol(expr, LCtx, visitCount, symbolTag);
175  }
176 
177  /// Construct an SVal representing '0' for the specified type.
179 
180  /// Make a unique symbol for value of region.
182 
183  /// Create a new symbol with a unique 'name'.
184  ///
185  /// We resort to conjured symbols when we cannot construct a derived symbol.
186  /// The advantage of symbols derived/built from other symbols is that we
187  /// preserve the relation between related(or even equivalent) expressions, so
188  /// conjured symbols should be used sparingly.
189  DefinedOrUnknownSVal conjureSymbolVal(const void *symbolTag,
190  const Expr *expr,
191  const LocationContext *LCtx,
192  unsigned count);
193  DefinedOrUnknownSVal conjureSymbolVal(const void *symbolTag,
194  const Expr *expr,
195  const LocationContext *LCtx,
196  QualType type,
197  unsigned count);
199  const LocationContext *LCtx,
200  QualType type,
201  unsigned visitCount);
202 
203  /// Conjure a symbol representing heap allocated memory region.
204  ///
205  /// Note, the expression should represent a location.
207  const LocationContext *LCtx,
208  unsigned Count);
209 
210  /// Conjure a symbol representing heap allocated memory region.
211  ///
212  /// Note, now, the expression *doesn't* need to represent a location.
213  /// But the type need to!
215  const LocationContext *LCtx,
216  QualType type, unsigned Count);
217 
219  SymbolRef parentSymbol, const TypedValueRegion *region);
220 
221  DefinedSVal getMetadataSymbolVal(const void *symbolTag,
222  const MemRegion *region,
223  const Expr *expr, QualType type,
224  const LocationContext *LCtx,
225  unsigned count);
226 
228 
230 
231  DefinedSVal getBlockPointer(const BlockDecl *block, CanQualType locTy,
232  const LocationContext *locContext,
233  unsigned blockCount);
234 
235  /// Returns the value of \p E, if it can be determined in a non-path-sensitive
236  /// manner.
237  ///
238  /// If \p E is not a constant or cannot be modeled, returns \c None.
240 
241  NonLoc makeCompoundVal(QualType type, llvm::ImmutableList<SVal> vals) {
243  }
244 
246  const TypedValueRegion *region) {
248  BasicVals.getLazyCompoundValData(store, region));
249  }
250 
252  return nonloc::PointerToMember(DD);
253  }
254 
256  return nonloc::PointerToMember(PTMD);
257  }
258 
260  return nonloc::ConcreteInt(BasicVals.getValue(0, ArrayIndexTy));
261  }
262 
264  return nonloc::ConcreteInt(BasicVals.getValue(idx, ArrayIndexTy));
265  }
266 
268 
270  return nonloc::ConcreteInt(
271  BasicVals.getValue(integer->getValue(),
273  }
274 
276  return makeTruthVal(boolean->getValue(), boolean->getType());
277  }
278 
280 
282  return nonloc::ConcreteInt(BasicVals.getValue(integer));
283  }
284 
286  return loc::ConcreteInt(BasicVals.getValue(integer));
287  }
288 
289  NonLoc makeIntVal(const llvm::APInt& integer, bool isUnsigned) {
290  return nonloc::ConcreteInt(BasicVals.getValue(integer, isUnsigned));
291  }
292 
294  if (Loc::isLocType(type))
295  return loc::ConcreteInt(BasicVals.getValue(integer, type));
296 
297  return nonloc::ConcreteInt(BasicVals.getValue(integer, type));
298  }
299 
300  NonLoc makeIntVal(uint64_t integer, bool isUnsigned) {
301  return nonloc::ConcreteInt(BasicVals.getIntValue(integer, isUnsigned));
302  }
303 
305  return nonloc::ConcreteInt(BasicVals.getValue(integer, ptrType));
306  }
307 
308  NonLoc makeLocAsInteger(Loc loc, unsigned bits) {
310  }
311 
313  const llvm::APSInt &rhs, QualType type);
314 
316  BinaryOperator::Opcode op, const SymExpr *lhs,
317  QualType type);
318 
320  const SymExpr *rhs, QualType type);
321 
322  NonLoc makeNonLoc(const SymExpr *operand, UnaryOperator::Opcode op,
323  QualType type);
324 
325  /// Create a NonLoc value for cast.
326  nonloc::SymbolVal makeNonLoc(const SymExpr *operand, QualType fromTy,
327  QualType toTy);
328 
331  }
332 
335  }
336 
337  /// Create NULL pointer, with proper pointer bit-width for given address
338  /// space.
339  /// \param type pointer type.
341  // We cannot use the `isAnyPointerType()`.
342  assert((type->isPointerType() || type->isObjCObjectPointerType() ||
343  type->isBlockPointerType() || type->isNullPtrType() ||
344  type->isReferenceType()) &&
345  "makeNullWithType must use pointer type");
346 
347  // The `sizeof(T&)` is `sizeof(T)`, thus we replace the reference with a
348  // pointer. Here we assume that references are actually implemented by
349  // pointers under-the-hood.
350  type = type->isReferenceType()
351  ? Context.getPointerType(type->getPointeeType())
352  : type;
354  }
355 
358  }
359 
361  return loc::MemRegionVal(region);
362  }
363 
365  return loc::GotoLabel(expr->getLabel());
366  }
367 
369  return loc::ConcreteInt(BasicVals.getValue(integer));
370  }
371 
372  /// Return MemRegionVal on success cast, otherwise return None.
374  QualType type);
375 
376  /// Make an SVal that represents the given symbol. This follows the convention
377  /// of representing Loc-type symbols (symbolic pointers and references)
378  /// as Loc values wrapping the symbol rather than as plain symbol values.
380  if (Loc::isLocType(Sym->getType()))
381  return makeLoc(Sym);
382  return nonloc::SymbolVal(Sym);
383  }
384 
385  /// Return a memory region for the 'this' object reference.
387  const StackFrameContext *SFC);
388 
389  /// Return a memory region for the 'this' object reference.
391  const StackFrameContext *SFC);
392 };
393 
394 SValBuilder* createSimpleSValBuilder(llvm::BumpPtrAllocator &alloc,
395  ASTContext &context,
396  ProgramStateManager &stateMgr);
397 
398 } // namespace ento
399 
400 } // namespace clang
401 
402 #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:484
clang::ento::Loc::isLocType
static bool isLocType(QualType T)
Definition: SVals.h:290
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:113
clang::ento::SValBuilder::getAnalyzerOptions
const AnalyzerOptions & getAnalyzerOptions() const
Definition: SValBuilder.h:158
clang::ento::SValBuilder::getStateManager
ProgramStateManager & getStateManager()
Definition: SValBuilder.h:139
clang::ento::SValBuilder::makeLazyCompoundVal
NonLoc makeLazyCompoundVal(const StoreRef &store, const TypedValueRegion *region)
Definition: SValBuilder.h:245
clang::LocationContext
It wraps the AnalysisDeclContext to represent both the call stack with the help of StackFrameContext ...
Definition: AnalysisDeclContext.h:215
clang::ento::SValBuilder::evalUnaryOp
SVal evalUnaryOp(ProgramStateRef state, UnaryOperator::Opcode opc, SVal operand, QualType type)
Definition: SValBuilder.cpp:471
SVals.h
clang::ento::nonloc::CompoundVal
Definition: SVals.h:377
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:234
clang::ento::SValBuilder::makePointerToMember
NonLoc makePointerToMember(const PointerToMemberData *PTMD)
Definition: SValBuilder.h:255
clang::ento::NonLoc
Definition: SVals.h:266
clang::ento::SValBuilder::makeLocAsInteger
NonLoc makeLocAsInteger(Loc loc, unsigned bits)
Definition: SValBuilder.h:308
clang::ento::DefinedOrUnknownSVal
Definition: SVals.h:221
clang::ento::createSimpleSValBuilder
SValBuilder * createSimpleSValBuilder(llvm::BumpPtrAllocator &alloc, ASTContext &context, ProgramStateManager &stateMgr)
Definition: SimpleSValBuilder.cpp:85
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:340
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:737
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:251
ProgramState_Fwd.h
SymbolManager.h
clang::ento::SValBuilder::getArrayIndexType
QualType getArrayIndexType() const
Definition: SValBuilder.h:145
clang::ento::loc::GotoLabel
Definition: SVals.h:489
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:63
clang::StackFrameContext
It represents a stack frame of the call stack (based on CallEvent).
Definition: AnalysisDeclContext.h:299
clang::ento::nonloc::ConcreteInt
Value representing integer constant.
Definition: SVals.h:330
clang::ento::BasicValueFactory::getCompoundValData
const CompoundValData * getCompoundValData(QualType T, llvm::ImmutableList< SVal > Vals)
Definition: BasicValueFactory.cpp:126
clang::ento::loc::MemRegionVal
Definition: SVals.h:506
clang::ento::loc::ConcreteInt
Definition: SVals.h:540
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:78
b
__device__ __2f16 b
Definition: __clang_hip_libdevice_declares.h:319
clang::ento::SValBuilder::getKnownValue
virtual const llvm::APSInt * getKnownValue(ProgramStateRef state, SVal val)=0
Evaluates a given SVal.
clang::ento::SValBuilder::evalMinus
SVal evalMinus(NonLoc val)
Definition: SValBuilder.cpp:447
clang::ento::SValBuilder::makeSymbolVal
DefinedSVal makeSymbolVal(SymbolRef Sym)
Make an SVal that represents the given symbol.
Definition: SValBuilder.h:379
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:95
clang::ento::ConditionTruthVal
Definition: ConstraintManager.h:38
APSInt
llvm::APSInt APSInt
Definition: ByteCodeEmitter.cpp:19
clang::ento::SValBuilder::evalComplement
SVal evalComplement(NonLoc val)
Definition: SValBuilder.cpp:459
clang::ento::SValBuilder::makeIntValWithWidth
NonLoc makeIntValWithWidth(QualType ptrType, uint64_t integer)
Definition: SValBuilder.h:304
SymExpr.h
V
#define V(N, I)
Definition: ASTContext.h:3237
clang::IntegerLiteral
Definition: Expr.h:1503
clang::ast_matchers::expr
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
Definition: ASTMatchersInternal.cpp:890
clang::ento::DefinedSVal
Definition: SVals.h:243
clang::ento::SValBuilder::makeIntVal
DefinedSVal makeIntVal(uint64_t integer, QualType type)
Definition: SValBuilder.h:293
clang::ento::SValBuilder::makeLoc
loc::MemRegionVal makeLoc(const MemRegion *region)
Definition: SValBuilder.h:360
clang::ento::SValBuilder::conjureSymbol
const SymbolConjured * conjureSymbol(const Stmt *stmt, const LocationContext *LCtx, QualType type, unsigned visitCount, const void *symbolTag=nullptr)
Definition: SValBuilder.h:162
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:4283
clang::ento::SValBuilder::getRegionValueSymbolVal
DefinedOrUnknownSVal getRegionValueSymbolVal(const TypedValueRegion *region)
Make a unique symbol for value of region.
Definition: SValBuilder.cpp:141
clang::ento::SValBuilder::getContext
ASTContext & getContext()
Definition: SValBuilder.h:136
hlsl::uint64_t
unsigned long uint64_t
Definition: hlsl_basic_types.h:25
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:209
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:308
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:53
clang::ento::SValBuilder::makeZeroArrayIndex
NonLoc makeZeroArrayIndex()
Definition: SValBuilder.h:259
clang::ento::SValBuilder::convertToArrayIndex
SVal convertToArrayIndex(SVal val)
Definition: SValBuilder.cpp:122
clang::ento::SValBuilder::getRegionManager
MemRegionManager & getRegionManager()
Definition: SValBuilder.h:155
clang::ento::SValBuilder::getContext
const ASTContext & getContext() const
Definition: SValBuilder.h:137
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:322
ASTContext.h
clang::ento::SValBuilder::getBasicValueFactory
BasicValueFactory & getBasicValueFactory()
Definition: SValBuilder.h:149
clang::ento::SValBuilder::makeLoc
loc::GotoLabel makeLoc(const AddrLabelExpr *expr)
Definition: SValBuilder.h:364
clang::ento::SValBuilder::makePointerToMember
NonLoc makePointerToMember(const DeclaratorDecl *DD)
Definition: SValBuilder.h:251
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:2090
BasicValueFactory.h
clang::ento::nonloc::LazyCompoundVal
Definition: SVals.h:402
clang::ento::BasicValueFactory::getIntValue
const llvm::APSInt & getIntValue(uint64_t X, bool isUnsigned)
Definition: BasicValueFactory.h:183
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:282
clang::ento::SValBuilder::getCastedMemRegionVal
Optional< loc::MemRegionVal > getCastedMemRegionVal(const MemRegion *region, QualType type)
Return MemRegionVal on success cast, otherwise return None.
Definition: SValBuilder.cpp:301
clang::APIntStorage::getValue
llvm::APInt getValue() const
Definition: Expr.h:1487
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:422
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:241
clang::ento::SValBuilder::makeLoc
loc::MemRegionVal makeLoc(SymbolRef sym)
Definition: SValBuilder.h:356
clang::ento::ProgramStateManager
Definition: ProgramState.h:502
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:1092
clang::ASTContext::IntTy
CanQualType IntTy
Definition: ASTContext.h:1116
clang::ento::SValBuilder::getBasicValueFactory
const BasicValueFactory & getBasicValueFactory() const
Definition: SValBuilder.h:150
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:289
clang::DeclaratorDecl
Represents a ValueDecl that came out of a declarator.
Definition: Decl.h:758
clang::AddrLabelExpr
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:4309
clang::ento::SValBuilder::makeIntVal
nonloc::ConcreteInt makeIntVal(const IntegerLiteral *integer)
Definition: SValBuilder.h:269
clang::ento::SValBuilder::makeIntLocVal
loc::ConcreteInt makeIntLocVal(const llvm::APSInt &integer)
Definition: SValBuilder.h:285
clang::ento::SValBuilder::getSymbolManager
const SymbolManager & getSymbolManager() const
Definition: SValBuilder.h:153
LLVM.h
clang::AnalyzerOptions
Stores options for the analyzer from the command line.
Definition: AnalyzerOptions.h:150
State
LineState State
Definition: UnwrappedLineFormatter.cpp:1147
clang::UnaryOperatorKind
UnaryOperatorKind
Definition: OperationKinds.h:30
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:281
clang::ento::SValBuilder::getFunctionPointer
DefinedSVal getFunctionPointer(const FunctionDecl *func)
Definition: SValBuilder.cpp:285
clang::ento::SValBuilder::makeIntVal
NonLoc makeIntVal(uint64_t integer, bool isUnsigned)
Definition: SValBuilder.h:300
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:170
clang::ento::SValBuilder::getBlockPointer
DefinedSVal getBlockPointer(const BlockDecl *block, CanQualType locTy, const LocationContext *locContext, unsigned blockCount)
Definition: SValBuilder.cpp:289
clang::ento::SValBuilder::getRegionManager
const MemRegionManager & getRegionManager() const
Definition: SValBuilder.h:156
clang::ento::SValBuilder::ArrayIndexWidth
const unsigned ArrayIndexWidth
The width of the scalar type used for array indices.
Definition: SValBuilder.h:76
clang::ento::MemRegionManager
Definition: MemRegion.h:1353
clang::ento::SValBuilder::makeLoc
loc::ConcreteInt makeLoc(const llvm::APSInt &integer)
Definition: SValBuilder.h:368
clang::ento::nonloc::SymbolVal
Represents symbolic expression that isn't a location.
Definition: SVals.h:305
clang::ento::SValBuilder::makeTruthVal
nonloc::ConcreteInt makeTruthVal(bool b, QualType type)
Definition: SValBuilder.h:329
DeclarationName.h
clang::ento::SValBuilder::areEqual
ConditionTruthVal areEqual(ProgramStateRef state, SVal lhs, SVal rhs)
Definition: SValBuilder.cpp:534
clang::ento::SValBuilder::~SValBuilder
virtual ~SValBuilder()=default
clang::ento::nonloc::LocAsInteger
Definition: SVals.h:345
clang
Definition: CalledOnceCheck.h:17
clang::Stmt
Stmt - This represents one statement.
Definition: Stmt.h:71
clang::ento::SValBuilder::evalIntegralCast
SVal evalIntegralCast(ProgramStateRef state, SVal val, QualType castTy, QualType originalType)
Definition: SValBuilder.cpp:586
clang::ento::SValBuilder::BasicVals
BasicValueFactory BasicVals
Manager of APSInt values.
Definition: SValBuilder.h:60
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:275
clang::ento::SValBuilder::getSymbolManager
SymbolManager & getSymbolManager()
Definition: SValBuilder.h:152
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:263
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:3341
clang::ento::PointerToMemberData
Definition: BasicValueFactory.h:86
clang::ento::SVal
SVal - This represents a symbolic expression, which can be either an L-value or an R-value.
Definition: SVals.h:73
clang::ento::SValBuilder::makeNonLoc
nonloc::SymbolVal makeNonLoc(const SymExpr *lhs, BinaryOperator::Opcode op, const llvm::APSInt &rhs, QualType type)
Definition: SValBuilder.cpp:78
clang::ento::TypedValueRegion
TypedValueRegion - An abstract class representing regions having a typed value.
Definition: MemRegion.h:531
clang::ento::MemRegionManager::getSymbolicRegion
const SymbolicRegion * getSymbolicRegion(SymbolRef Sym, const MemSpaceRegion *MemSpace=nullptr)
Retrieve or create a "symbolic" memory region.
Definition: MemRegion.cpp:1169
clang::ento::SValBuilder::evalEQ
SVal evalEQ(ProgramStateRef state, SVal lhs, SVal rhs)
Definition: SValBuilder.cpp:539
clang::Expr
This represents one expression.
Definition: Expr.h:109
clang::ento::SValBuilder::makeTruthVal
nonloc::ConcreteInt makeTruthVal(bool b)
Definition: SValBuilder.h:333
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:141
clang::ento::SValBuilder::getMemberPointer
DefinedSVal getMemberPointer(const NamedDecl *ND)
Definition: SValBuilder.cpp:269
clang::ASTContext::BoolTy
CanQualType BoolTy
Definition: ASTContext.h:1108
clang::FunctionDecl
Represents a function declaration or definition.
Definition: Decl.h:1904
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:481
clang::ento::BasicValueFactory::getZeroWithTypeSize
const llvm::APSInt & getZeroWithTypeSize(QualType T)
Definition: BasicValueFactory.h:224
clang::ASTContext::getLangOpts
const LangOptions & getLangOpts() const
Definition: ASTContext.h:791
llvm::IntrusiveRefCntPtr< const ProgramState >
clang::CXXMethodDecl
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:1983
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:229