15 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SVALS_H
16 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_SVALS_H
21 #include "llvm/ADT/ImmutableList.h"
31 class CompoundValData;
32 class LazyCompoundValData;
34 class BasicValueFactory;
36 class TypedValueRegion;
37 class MemRegionManager;
38 class ProgramStateManager;
63 explicit SVal(
const void *d,
bool isLoc,
unsigned ValKind)
76 assert(T::isKind(*
this));
87 if (!T::isKind(*
this))
114 return !(*
this == R);
197 static bool isKind(
const SVal& V) {
206 bool isUndef()
const =
delete;
207 bool isValid()
const =
delete;
212 :
SVal(d, isLoc, ValKind) {}
219 static bool isKind(
const SVal& V) {
230 static bool isKind(
const SVal &V) {
239 bool isUnknown()
const =
delete;
240 bool isUnknownOrUndef()
const =
delete;
241 bool isValid()
const =
delete;
248 static bool isKind(
const SVal& V) {
258 static bool isKind(
const SVal &V) {
269 explicit NonLoc(
unsigned SubKind,
const void *d)
277 static bool isKind(
const SVal& V) {
285 explicit Loc(
unsigned SubKind,
const void *D)
298 static bool isKind(
const SVal& V) {
328 static bool isKind(
const SVal& V) {
333 static bool isKind(
const NonLoc& V) {
344 return *
static_cast<const llvm::APSInt*
>(
Data);
358 static bool isKind(
const SVal& V) {
363 static bool isKind(
const NonLoc& V) {
371 explicit LocAsInteger(
const std::pair<SVal, uintptr_t> &data)
373 assert (data.first.getAs<
Loc>());
379 const std::pair<SVal, uintptr_t> *D =
380 static_cast<const std::pair<SVal, uintptr_t> *
>(
Data);
385 const std::pair<SVal, uintptr_t> *D =
386 static_cast<const std::pair<SVal, uintptr_t> *
>(
Data);
387 const SVal& V = D->first;
392 const std::pair<SVal, uintptr_t> *D =
393 static_cast<const std::pair<SVal, uintptr_t> *
>(
Data);
400 static bool isKind(
const SVal& V) {
405 static bool isKind(
const NonLoc& V) {
427 static bool isKind(
const SVal& V) {
431 static bool isKind(
const NonLoc& V) {
451 static bool isKind(
const SVal& V) {
455 static bool isKind(
const NonLoc& V) {
481 static bool isKind(
const SVal& V) {
485 static bool isKind(
const Loc& V) {
503 template <
typename REGION>
519 static bool isKind(
const SVal& V) {
524 static bool isKind(
const Loc& V) {
534 return *
static_cast<const llvm::APSInt*
>(
Data);
544 static bool isKind(
const SVal& V) {
549 static bool isKind(
const Loc& V) {
567 template <
typename T>
struct isPodLike;
569 static const bool value =
true;
KnownSVal(const UndefinedVal &V)
void Profile(llvm::FoldingSetNodeID &ID) const
const SymExpr * getAsSymExpr() const
TypedValueRegion - An abstract class representing regions having a typed value.
bool hasConjuredSymbol() const
hasConjuredSymbol - If this SVal wraps a conjured symbol, return true;
bool isNullPtrType() const
MemRegion - The root abstract class for all memory regions.
SVal(BaseKind k, const void *D=nullptr)
bool operator==(const SVal &R) const
const MemRegion * stripCasts(bool StripBaseCasts=true) const
Get the underlining region and strip casts.
bool operator==(const MemRegionVal &R) const
DefinedOrUnknownSVal(const void *d, bool isLoc, unsigned ValKind)
SVal(const void *d, bool isLoc, unsigned ValKind)
void dumpToStream(raw_ostream &Out) const
SymbolRef getLocSymbolInBase() const
Get the symbol in the SVal or its base region.
Loc(unsigned SubKind, const void *D)
bool isBlockPointerType() const
Value representing integer constant.
bool isZeroConstant() const
Symbolic value. These values used to capture symbolic execution of the program.
Loc getPersistentLoc() const
bool operator!=(const SVal &R) const
bool isReferenceType() const
bool isAnyPointerType() const
BaseKind getBaseKind() const
ConcreteInt(const llvm::APSInt &V)
SymbolRef getAsLocSymbol(bool IncludeBaseRegions=false) const
If this SVal is a location and wraps a symbol, return that SymbolRef. Otherwise return 0...
SVal evalBinOp(BasicValueFactory &BasicVals, BinaryOperator::Opcode Op, const ConcreteInt &R) const
const FunctionDecl * getAsFunctionDecl() const
static bool isLocType(QualType T)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
bool isUnknownOrUndef() const
SymExpr::symbol_iterator symbol_begin() const
const CompoundValData * getValue() const
unsigned getNumBits() const
KnownSVal(const DefinedSVal &V)
llvm::ImmutableList< SVal >::iterator iterator
ID
Defines the set of possible language-specific address spaces.
unsigned getRawKind() const
Optional< T > getAs() const
Convert to the specified SVal type, returning None if this SVal is not of the desired type...
MemRegionVal(const MemRegion *r)
const LazyCompoundValData * getCVData() const
NonLoc(unsigned SubKind, const void *d)
SVal evalBinOp(SValBuilder &svalBuilder, BinaryOperator::Opcode Op, const ConcreteInt &R) const
const REGION * getRegionAs() const
void dumpToStream(raw_ostream &Out) const
SymExpr::symbol_iterator symbol_end() const
SymbolRef getSymbol() const
ConcreteInt evalMinus(SValBuilder &svalBuilder) const
DefinedOrUnknownSVal(BaseKind k, void *D=nullptr)
GotoLabel(LabelDecl *Label)
unsigned getSubKind() const
const llvm::APSInt & getValue() const
SmallVector< SVal, 5 > BufferTy
BufferTy - A temporary buffer to hold a set of SVals.
const LabelDecl * getLabel() const
static symbol_iterator symbol_end()
DefinedSVal(const void *d, bool isLoc, unsigned ValKind)
bool isExpression() const
Represents symbolic expression.
const MemRegion * getAsRegion() const
Represents an SVal that is guaranteed to not be UnknownVal.
ConcreteInt evalComplement(SValBuilder &svalBuilder) const
const TypedValueRegion * getRegion() const
static raw_ostream & operator<<(raw_ostream &os, const clang::ento::MemRegion *R)
void dumpToStream(raw_ostream &OS) const
bool operator!=(const MemRegionVal &R) const
SymbolRef getAsSymbol(bool IncludeBaseRegions=false) const
If this SVal wraps a symbol return that SymbolRef. Otherwise, return 0.
symbol_iterator symbol_begin() const
const SymExpr * getAsSymbolicExpression() const
ConcreteInt(const llvm::APSInt &V)
const llvm::APSInt & getValue() const
T castAs() const
Convert to the specified SVal type, asserting that this SVal is of the desired type.
const MemRegion * getRegion() const
Get the underlining region.
Iterator over symbols that the current symbol depends on.
const void * getStore() const