21 #include "llvm/ADT/APSInt.h" 22 #include "llvm/ADT/FoldingSet.h" 23 #include "llvm/ADT/ImmutableList.h" 24 #include "llvm/ADT/STLExtras.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();
90 const llvm::APSInt& BasicValueFactory::getValue(
const llvm::APSInt&
X) {
91 llvm::FoldingSetNodeID
ID;
94 using FoldNodeTy = llvm::FoldingSetNodeWrapper<llvm::APSInt>;
97 FoldNodeTy*
P = APSIntSet.FindNodeOrInsertPos(ID, InsertPos);
100 P = (FoldNodeTy*) BPAlloc.Allocate<FoldNodeTy>();
101 new (
P) FoldNodeTy(X);
102 APSIntSet.InsertNode(P, InsertPos);
108 const llvm::APSInt& BasicValueFactory::getValue(
const llvm::APInt&
X,
110 llvm::APSInt V(X, isUnsigned);
114 const llvm::APSInt& BasicValueFactory::getValue(uint64_t
X,
unsigned BitWidth,
116 llvm::APSInt V(BitWidth, isUnsigned);
121 const llvm::APSInt& BasicValueFactory::getValue(uint64_t
X,
QualType T) {
127 llvm::ImmutableList<SVal> Vals) {
128 llvm::FoldingSetNodeID
ID;
132 CompoundValData* D = CompoundValDataSet.FindNodeOrInsertPos(ID, InsertPos);
137 CompoundValDataSet.InsertNode(D, InsertPos);
146 llvm::FoldingSetNodeID
ID;
151 LazyCompoundValDataSet.FindNodeOrInsertPos(ID, InsertPos);
156 LazyCompoundValDataSet.InsertNode(D, InsertPos);
163 const DeclaratorDecl *DD, llvm::ImmutableList<const CXXBaseSpecifier *> L) {
164 llvm::FoldingSetNodeID
ID;
169 PointerToMemberDataSet.FindNodeOrInsertPos(ID, InsertPos);
174 PointerToMemberDataSet.InsertNode(D, InsertPos);
181 llvm::iterator_range<CastExpr::path_const_iterator> PathRange,
185 llvm::ImmutableList<const CXXBaseSpecifier *> PathList;
191 PathList = CXXBaseListFactory.getEmptyList();
200 for (
const auto &I : llvm::reverse(PathRange))
201 PathList = prependCXXBase(I, PathList);
202 return getPointerToMemberData(DD, PathList);
207 const llvm::APSInt& V1,
const llvm::APSInt& V2) {
210 assert(
false &&
"Invalid Opcode.");
235 if (V1.isSigned() && V1.isNegative())
238 if (V2.isSigned() && V2.isNegative())
241 uint64_t Amt = V2.getZExtValue();
243 if (Amt >= V1.getBitWidth())
246 if (V1.isSigned() && Amt > V1.countLeadingZeros())
249 return &
getValue( V1.operator<<( (
unsigned) Amt ));
256 if (V2.isSigned() && V2.isNegative())
259 uint64_t Amt = V2.getZExtValue();
261 if (Amt >= V1.getBitWidth())
264 return &
getValue( V1.operator>>( (
unsigned) Amt ));
268 return &getTruthValue( V1 < V2 );
271 return &getTruthValue( V1 > V2 );
274 return &getTruthValue( V1 <= V2 );
277 return &getTruthValue( V1 >= V2 );
280 return &getTruthValue( V1 == V2 );
283 return &getTruthValue( V1 != V2 );
298 const std::pair<SVal, uintptr_t>&
303 llvm::FoldingSetNodeID
ID;
306 ID.AddPointer((
void*) Data);
310 using FoldNodeTy = llvm::FoldingSetNodeWrapper<SValData>;
312 FoldNodeTy*
P = Map.FindNodeOrInsertPos(ID, InsertPos);
315 P = (FoldNodeTy*) BPAlloc.Allocate<FoldNodeTy>();
316 new (
P) FoldNodeTy(std::make_pair(V, Data));
317 Map.InsertNode(P, InsertPos);
320 return P->getValue();
323 const std::pair<SVal, SVal>&
328 llvm::FoldingSetNodeID
ID;
335 using FoldNodeTy = llvm::FoldingSetNodeWrapper<SValPair>;
337 FoldNodeTy*
P = Map.FindNodeOrInsertPos(ID, InsertPos);
340 P = (FoldNodeTy*) BPAlloc.Allocate<FoldNodeTy>();
341 new (
P) FoldNodeTy(std::make_pair(V1, V2));
342 Map.InsertNode(P, InsertPos);
345 return P->getValue();
349 return &getPersistentSValWithData(X, 0).first;
TypedValueRegion - An abstract class representing regions having a typed value.
A (possibly-)qualified type.
llvm::ImmutableList< const CXXBaseSpecifier * > getCXXBaseList() const
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
const CompoundValData * getCompoundValData(QualType T, llvm::ImmutableList< SVal > Vals)
const std::pair< SVal, SVal > & getPersistentSValPair(const SVal &V1, const SVal &V2)
std::pair< SVal, SVal > SValPair
const PointerToMemberData * accumCXXBase(llvm::iterator_range< CastExpr::path_const_iterator > PathRange, const nonloc::PointerToMember &PTM)
const PTMDataType getPTMData() const
const DeclaratorDecl * getDeclaratorDecl() const
Value representing pointer-to-member.
llvm::FoldingSet< llvm::FoldingSetNodeWrapper< SValData > > PersistentSValsTy
const SVal * getPersistentSVal(SVal X)
Represents a ValueDecl that came out of a declarator.
const PointerToMemberData * getPointerToMemberData(const DeclaratorDecl *DD, llvm::ImmutableList< const CXXBaseSpecifier *> L)
void Profile(llvm::FoldingSetNodeID &ID) const
static SVal getValue(SVal val, SValBuilder &svalBuilder)
__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(llvm::FoldingSetNodeID &ID, const StoreRef &store, const TypedValueRegion *region)
void Profile(llvm::FoldingSetNodeID &ID) const
static void Profile(llvm::FoldingSetNodeID &ID, const DeclaratorDecl *D, llvm::ImmutableList< const CXXBaseSpecifier *> L)
SVal - This represents a symbolic expression, which can be either an L-value or an R-value...
const llvm::APSInt * evalAPSInt(BinaryOperator::Opcode Op, const llvm::APSInt &V1, const llvm::APSInt &V2)
Dataflow Directional Tag Classes.
std::pair< SVal, uintptr_t > SValData
static void Profile(llvm::FoldingSetNodeID &ID, QualType T, llvm::ImmutableList< SVal > L)
llvm::PointerUnion< const DeclaratorDecl *, const PointerToMemberData * > PTMDataType
static void Profile(const SValPair &X, llvm::FoldingSetNodeID &ID)
const std::pair< SVal, uintptr_t > & getPersistentSValWithData(const SVal &V, uintptr_t Data)
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
const LazyCompoundValData * getLazyCompoundValData(const StoreRef &store, const TypedValueRegion *region)
static void Profile(const SValData &X, llvm::FoldingSetNodeID &ID)
llvm::FoldingSet< llvm::FoldingSetNodeWrapper< SValPair > > PersistentSValPairsTy
CompoundValData(QualType t, llvm::ImmutableList< SVal > l)