13 #ifndef LLVM_CLANG_LIB_STATICANALYZER_CORE_RANGEDCONSTRAINTMANAGER_H 14 #define LLVM_CLANG_LIB_STATICANALYZER_CORE_RANGEDCONSTRAINTMANAGER_H 27 class Range :
public std::pair<const llvm::APSInt *, const llvm::APSInt *> {
34 return *first <= v && v <= *second;
43 ID.AddPointer(&
From());
48 class RangeTrait :
public llvm::ImutContainerInfo<Range> {
54 static inline bool isLess(key_type_ref lhs, key_type_ref rhs) {
55 return *lhs.first < *rhs.first ||
56 (!(*rhs.first < *lhs.first) && *lhs.second < *rhs.second);
64 typedef llvm::ImmutableSet<Range, RangeTrait> PrimRangeSet;
77 PrimRangeSet Ranges(RS.ranges);
78 for (
const auto &
range : ranges)
79 Ranges = F.add(Ranges,
range);
83 iterator
begin()
const {
return ranges.begin(); }
84 iterator
end()
const {
return ranges.end(); }
86 bool isEmpty()
const {
return ranges.isEmpty(); }
90 : ranges(F.add(F.getEmptySet(),
Range(from, to))) {}
94 void Profile(llvm::FoldingSetNodeID &
ID)
const { ranges.Profile(ID); }
100 return ranges.isSingleton() ? ranges.begin()->getConcreteValue() :
nullptr;
106 PrimRangeSet &newRanges, PrimRangeSet::iterator &i,
107 PrimRangeSet::iterator &e)
const;
120 void print(raw_ostream &os)
const;
123 return ranges == other.ranges;
134 static void *GDMIndex();
150 bool Assumption)
override;
158 bool Assumption)
override;
const llvm::APSInt & From() const
void Profile(llvm::FoldingSetNodeID &ID) const
Specialize PointerLikeTypeTraits to allow LazyGenerationalUpdatePtr to be placed into a PointerUnion...
A Range represents the closed range [from, to].
llvm::ImmutableMap< SymbolRef, RangeSet > ConstraintRangeTy
RangeSet contains a set of ranges.
void print(llvm::raw_ostream &OS, const Pointer &P, ASTContext &Ctx, QualType Ty)
static bool isLess(key_type_ref lhs, key_type_ref rhs)
Range(const llvm::APSInt &from, const llvm::APSInt &to)
RangeSet addRange(Factory &F, const RangeSet &RS)
Create a new set with all ranges of this set and RS.
PrimRangeSet::Factory Factory
RangeSet(Factory &F, const llvm::APSInt &from, const llvm::APSInt &to)
Construct a new RangeSet representing '{ [from, to] }'.
const llvm::APSInt * getConcreteValue() const
const llvm::APSInt * getConcreteValue() const
getConcreteValue - If a symbol is contrained to equal a specific integer constant then this method re...
bool Includes(const llvm::APSInt &v) const
bool InRange(InterpState &S, CodePtr OpPC)
void Profile(llvm::FoldingSetNodeID &ID) const
Profile - Generates a hash profile of this RangeSet for use by FoldingSet.
bool operator==(const RangeSet &other) const
Dataflow Directional Tag Classes.
RangeSet(PrimRangeSet RS)
const llvm::APSInt & To() const
PrimRangeSet::iterator iterator
RangedConstraintManager(SubEngine *SE, SValBuilder &SB)