16 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_BASICVALUEFACTORY_H 17 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_BASICVALUEFACTORY_H 26 #include "llvm/ADT/APSInt.h" 27 #include "llvm/ADT/FoldingSet.h" 28 #include "llvm/ADT/ImmutableList.h" 29 #include "llvm/ADT/iterator_range.h" 30 #include "llvm/Support/Allocator.h" 37 class CXXBaseSpecifier;
44 llvm::ImmutableList<SVal> L;
51 using iterator = llvm::ImmutableList<SVal>::iterator;
57 llvm::ImmutableList<SVal> L);
68 : store(st), region(r) {
75 static void Profile(llvm::FoldingSetNodeID&
ID,
84 llvm::ImmutableList<const CXXBaseSpecifier *> L;
88 llvm::ImmutableList<const CXXBaseSpecifier *> L)
91 using iterator = llvm::ImmutableList<const CXXBaseSpecifier *>::iterator;
97 llvm::ImmutableList<const CXXBaseSpecifier *> L);
109 llvm::FoldingSet<llvm::FoldingSetNodeWrapper<llvm::APSInt>>;
112 llvm::BumpPtrAllocator& BPAlloc;
114 APSIntSetTy APSIntSet;
115 void *PersistentSVals =
nullptr;
116 void *PersistentSValPairs =
nullptr;
120 llvm::FoldingSet<CompoundValData> CompoundValDataSet;
121 llvm::FoldingSet<LazyCompoundValData> LazyCompoundValDataSet;
122 llvm::FoldingSet<PointerToMemberData> PointerToMemberDataSet;
126 const llvm::APSInt&
getValue(uint64_t
X,
unsigned BitWidth,
bool isUnsigned);
130 : Ctx(ctx), BPAlloc(Alloc), SValListFactory(Alloc),
131 CXXBaseListFactory(Alloc) {}
137 const llvm::APSInt&
getValue(
const llvm::APSInt& X);
138 const llvm::APSInt&
getValue(
const llvm::APInt& X,
bool isUnsigned);
150 const llvm::APSInt &
Convert(
const llvm::APSInt& To,
151 const llvm::APSInt& From) {
181 return getValue(getAPSIntType(T).getMaxValue());
185 return getValue(getAPSIntType(T).getMinValue());
188 const llvm::APSInt &
Add1(
const llvm::APSInt &V) {
194 const llvm::APSInt &
Sub1(
const llvm::APSInt &V) {
222 llvm::ImmutableList<SVal> Vals);
229 llvm::ImmutableList<const CXXBaseSpecifier *> L);
232 return SValListFactory.getEmptyList();
236 return SValListFactory.add(X, L);
240 return CXXBaseListFactory.getEmptyList();
245 llvm::ImmutableList<const CXXBaseSpecifier *> L) {
246 return CXXBaseListFactory.add(CBS, L);
250 llvm::iterator_range<CastExpr::path_const_iterator> PathRange,
254 const llvm::APSInt& V1,
255 const llvm::APSInt& V2);
257 const std::pair<SVal, uintptr_t>&
260 const std::pair<SVal, SVal>&
261 getPersistentSValPair(
const SVal& V1,
const SVal& V2);
263 const SVal* getPersistentSVal(
SVal X);
270 #endif // LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_BASICVALUEFACTORY_H
Defines the clang::ASTContext interface.
const llvm::APSInt & Convert(QualType T, const llvm::APSInt &From)
TypedValueRegion - An abstract class representing regions having a typed value.
A (possibly-)qualified type.
llvm::ImmutableList< const CXXBaseSpecifier * > getCXXBaseList() const
const llvm::APSInt & getMaxValue(QualType T)
const void * getStore() const
C Language Family Type Representation.
const llvm::APSInt & getTruthValue(bool b)
virtual QualType getValueType() const =0
const llvm::APSInt & getZeroWithTypeSize(QualType T)
QualType getLogicalOperationType() const
The result type of logical operations, '<', '>', '!=', etc.
LazyCompoundValData(const StoreRef &st, const TypedValueRegion *r)
const llvm::APSInt & Add1(const llvm::APSInt &V)
const llvm::APSInt & getTruthValue(bool b, QualType T)
const DeclaratorDecl * getDeclaratorDecl() const
const llvm::APSInt & getMinValue(QualType T)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Value representing pointer-to-member.
static bool isCompoundType(QualType T)
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
const llvm::APSInt & Convert(const llvm::APSInt &To, const llvm::APSInt &From)
Convert - Create a new persistent APSInt with the same value as 'From' but with the bitwidth and sign...
llvm::ImmutableList< SVal > prependSVal(SVal X, llvm::ImmutableList< SVal > L)
void Profile(llvm::FoldingSetNodeID &ID)
static bool isLocType(QualType T)
A record of the "type" of an APSInt, used for conversions.
bool isScalarType() const
const llvm::APSInt & getIntValue(uint64_t X, bool isUnsigned)
Represents a ValueDecl that came out of a declarator.
void Profile(llvm::FoldingSetNodeID &ID)
llvm::ImmutableList< SVal >::iterator iterator
const llvm::APSInt & getIntWithPtrWidth(uint64_t X, bool isUnsigned)
ASTContext & getContext() const
static SVal getValue(SVal val, SValBuilder &svalBuilder)
const TypedValueRegion * getRegion() const
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
llvm::ImmutableList< const CXXBaseSpecifier * > getEmptyCXXBaseList()
llvm::ImmutableList< const CXXBaseSpecifier * > prependCXXBase(const CXXBaseSpecifier *CBS, llvm::ImmutableList< const CXXBaseSpecifier *> L)
SVal - This represents a symbolic expression, which can be either an L-value or an R-value...
bool isSignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is signed or an enumeration types whose underlying ty...
const llvm::APSInt & Sub1(const llvm::APSInt &V)
const llvm::APSInt & getZeroWithPtrWidth(bool isUnsigned=true)
llvm::APSInt convert(const llvm::APSInt &Value) const LLVM_READONLY
Convert and return a new APSInt with the given value, but this type's bit width and signedness...
Dataflow Directional Tag Classes.
static void Profile(llvm::FoldingSetNodeID &ID, QualType T, llvm::ImmutableList< SVal > L)
llvm::ImmutableList< const CXXBaseSpecifier * >::iterator iterator
const llvm::APSInt & getMinValue(const llvm::APSInt &v)
unsigned getIntWidth(QualType T) const
APSIntType getAPSIntType(QualType T) const
Returns the type of the APSInt used to store values of the given QualType.
void Profile(llvm::FoldingSetNodeID &ID)
Represents a base class of a C++ class.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
BasicValueFactory(ASTContext &ctx, llvm::BumpPtrAllocator &Alloc)
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
PointerToMemberData(const DeclaratorDecl *D, llvm::ImmutableList< const CXXBaseSpecifier *> L)
const llvm::APSInt & getMaxValue(const llvm::APSInt &v)
static llvm::ImmutableListFactory< const FieldRegion * > Factory
CompoundValData(QualType t, llvm::ImmutableList< SVal > l)
llvm::ImmutableList< SVal > getEmptySValList()
CanQualType UnsignedIntTy