20 #include "llvm/ADT/APSInt.h"
21 #include "llvm/ADT/FoldingSet.h"
22 #include "llvm/ADT/ImmutableList.h"
23 #include "llvm/ADT/STLExtras.h"
24 #include "llvm/ADT/SmallPtrSet.h"
29 using namespace clang;
33 llvm::ImmutableList<SVal> L) {
35 ID.AddPointer(L.getInternalPointer());
42 ID.AddPointer(region);
47 llvm::ImmutableList<const CXXBaseSpecifier *> L) {
49 ID.AddPointer(L.getInternalPointer());
60 ID.AddPointer( (
void*)
X.second);
74 llvm::FoldingSet<llvm::FoldingSetNodeWrapper<SValData>>;
77 llvm::FoldingSet<llvm::FoldingSetNodeWrapper<SValPair>>;
83 for (
const auto &I : APSIntSet)
84 I.getValue().~APSInt();
91 llvm::FoldingSetNodeID
ID;
94 using FoldNodeTy = llvm::FoldingSetNodeWrapper<llvm::APSInt>;
97 FoldNodeTy*
P = APSIntSet.FindNodeOrInsertPos(
ID, InsertPos);
100 P =
new (BPAlloc) FoldNodeTy(
X);
101 APSIntSet.InsertNode(
P, InsertPos);
126 llvm::ImmutableList<SVal> Vals) {
127 llvm::FoldingSetNodeID
ID;
135 CompoundValDataSet.InsertNode(D, InsertPos);
144 llvm::FoldingSetNodeID
ID;
149 LazyCompoundValDataSet.FindNodeOrInsertPos(
ID, InsertPos);
153 LazyCompoundValDataSet.InsertNode(D, InsertPos);
160 const NamedDecl *ND, llvm::ImmutableList<const CXXBaseSpecifier *> L) {
161 llvm::FoldingSetNodeID
ID;
166 PointerToMemberDataSet.FindNodeOrInsertPos(
ID, InsertPos);
170 PointerToMemberDataSet.InsertNode(D, InsertPos);
177 llvm::ImmutableList<const CXXBaseSpecifier *> BaseSpecList) {
180 QualType BaseType = BaseSpec->getType();
182 if (!BaseSpecSeen.insert(BaseType).second)
189 llvm::iterator_range<CastExpr::path_const_iterator> PathRange,
191 assert((
kind == CK_DerivedToBaseMemberPointer ||
192 kind == CK_BaseToDerivedMemberPointer ||
193 kind == CK_ReinterpretMemberPointer) &&
194 "accumCXXBase called with wrong CastKind");
197 llvm::ImmutableList<const CXXBaseSpecifier *> BaseSpecList;
199 if (PTMDT.isNull() || PTMDT.is<
const NamedDecl *>()) {
203 BaseSpecList = CXXBaseListFactory.getEmptyList();
212 "CXXBaseSpecifier list of PointerToMemberData must not have repeated "
215 if (
kind == CK_DerivedToBaseMemberPointer) {
226 auto ReducedBaseSpecList = CXXBaseListFactory.getEmptyList();
229 return BaseSpec->getType() == I->getType();
231 if (llvm::none_of(PathRange, IsSameAsBaseSpec))
232 ReducedBaseSpecList =
233 CXXBaseListFactory.add(BaseSpec, ReducedBaseSpecList);
250 llvm_unreachable(
"Invalid Opcode.");
253 return &getValue( V1 * V2 );
258 return &getValue( V1 / V2 );
263 return &getValue( V1 % V2 );
266 return &getValue( V1 + V2 );
269 return &getValue( V1 - V2 );
275 if (V2.isNegative() || V2.getBitWidth() > 64)
280 if (Amt >= V1.getBitWidth())
283 return &getValue( V1.operator<<( (
unsigned) Amt ));
290 if (V2.isNegative() || V2.getBitWidth() > 64)
295 if (Amt >= V1.getBitWidth())
298 return &getValue( V1.operator>>( (
unsigned) Amt ));
322 return &getValue( V1 & V2 );
325 return &getValue( V1 | V2 );
328 return &getValue( V1 ^ V2 );
332 const std::pair<SVal, uintptr_t>&
337 llvm::FoldingSetNodeID
ID;
340 ID.AddPointer((
void*)
Data);
344 using FoldNodeTy = llvm::FoldingSetNodeWrapper<SValData>;
346 FoldNodeTy*
P = Map.FindNodeOrInsertPos(
ID, InsertPos);
349 P =
new (BPAlloc) FoldNodeTy(std::make_pair(
V,
Data));
350 Map.InsertNode(
P, InsertPos);
353 return P->getValue();
356 const std::pair<SVal, SVal>&
361 llvm::FoldingSetNodeID
ID;
368 using FoldNodeTy = llvm::FoldingSetNodeWrapper<SValPair>;
370 FoldNodeTy*
P = Map.FindNodeOrInsertPos(
ID, InsertPos);
373 P =
new (BPAlloc) FoldNodeTy(std::make_pair(V1, V2));
374 Map.InsertNode(
P, InsertPos);
377 return P->getValue();
static bool isUnsigned(SValBuilder &SVB, NonLoc Value)
std::pair< SVal, SVal > SValPair
llvm::FoldingSet< llvm::FoldingSetNodeWrapper< SValData > > PersistentSValsTy
llvm::FoldingSet< llvm::FoldingSetNodeWrapper< SValPair > > PersistentSValPairsTy
std::pair< SVal, uintptr_t > SValData
LLVM_ATTRIBUTE_UNUSED bool hasNoRepeatedElements(llvm::ImmutableList< const CXXBaseSpecifier * > BaseSpecList)
Represents a base class of a C++ class.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
This represents a decl that may have a name.
A (possibly-)qualified type.
llvm::ImmutableList< const CXXBaseSpecifier * > prependCXXBase(const CXXBaseSpecifier *CBS, llvm::ImmutableList< const CXXBaseSpecifier * > L)
const CompoundValData * getCompoundValData(QualType T, llvm::ImmutableList< SVal > Vals)
const std::pair< SVal, SVal > & getPersistentSValPair(const SVal &V1, const SVal &V2)
const llvm::APSInt & getTruthValue(bool b, QualType T)
const SVal * getPersistentSVal(SVal X)
const std::pair< SVal, uintptr_t > & getPersistentSValWithData(const SVal &V, uintptr_t Data)
const llvm::APSInt * evalAPSInt(BinaryOperator::Opcode Op, const llvm::APSInt &V1, const llvm::APSInt &V2)
APSIntType getAPSIntType(QualType T) const
Returns the type of the APSInt used to store values of the given QualType.
const PointerToMemberData * getPointerToMemberData(const NamedDecl *ND, llvm::ImmutableList< const CXXBaseSpecifier * > L)
const LazyCompoundValData * getLazyCompoundValData(const StoreRef &store, const TypedValueRegion *region)
const PointerToMemberData * accumCXXBase(llvm::iterator_range< CastExpr::path_const_iterator > PathRange, const nonloc::PointerToMember &PTM, const clang::CastKind &kind)
static void Profile(llvm::FoldingSetNodeID &ID, QualType T, llvm::ImmutableList< SVal > L)
static void Profile(llvm::FoldingSetNodeID &ID, const StoreRef &store, const TypedValueRegion *region)
const NamedDecl * getDeclaratorDecl() const
It might return null.
llvm::ImmutableList< const CXXBaseSpecifier * > getCXXBaseList() const
static void Profile(llvm::FoldingSetNodeID &ID, const NamedDecl *D, llvm::ImmutableList< const CXXBaseSpecifier * > L)
SVal - This represents a symbolic expression, which can be either an L-value or an R-value.
void Profile(llvm::FoldingSetNodeID &ID) const
TypedValueRegion - An abstract class representing regions having a typed value.
Value representing pointer-to-member.
llvm::PointerUnion< const NamedDecl *, const PointerToMemberData * > PTMDataType
const PTMDataType getPTMData() const
unsigned kind
All of the diagnostics that can be emitted by the frontend.
The JSON file list parser is used to communicate input to InstallAPI.
CastKind
CastKind - The kind of operation required for a conversion.
const FunctionProtoType * T
Diagnostic wrappers for TextAPI types for error reporting.
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
static void Profile(const SValData &X, llvm::FoldingSetNodeID &ID)
static void Profile(const SValPair &X, llvm::FoldingSetNodeID &ID)