clang  14.0.0git
RangedConstraintManager.h
Go to the documentation of this file.
1 //== RangedConstraintManager.h ----------------------------------*- C++ -*--==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Ranged constraint manager, built on SimpleConstraintManager.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_CLANG_LIB_STATICANALYZER_CORE_RANGEDCONSTRAINTMANAGER_H
14 #define LLVM_CLANG_LIB_STATICANALYZER_CORE_RANGEDCONSTRAINTMANAGER_H
15 
19 #include "llvm/ADT/APSInt.h"
20 #include "llvm/Support/Allocator.h"
21 
22 namespace clang {
23 
24 namespace ento {
25 
26 /// A Range represents the closed range [from, to]. The caller must
27 /// guarantee that from <= to. Note that Range is immutable, so as not
28 /// to subvert RangeSet's immutability.
29 class Range {
30 public:
31  Range(const llvm::APSInt &From, const llvm::APSInt &To) : Impl(&From, &To) {
32  assert(From <= To);
33  }
34 
35  Range(const llvm::APSInt &Point) : Range(Point, Point) {}
36 
37  bool Includes(const llvm::APSInt &Point) const {
38  return From() <= Point && Point <= To();
39  }
40  const llvm::APSInt &From() const { return *Impl.first; }
41  const llvm::APSInt &To() const { return *Impl.second; }
42  const llvm::APSInt *getConcreteValue() const {
43  return &From() == &To() ? &From() : nullptr;
44  }
45 
46  void Profile(llvm::FoldingSetNodeID &ID) const {
47  ID.AddPointer(&From());
48  ID.AddPointer(&To());
49  }
50  void dump(raw_ostream &OS) const;
51  void dump() const;
52 
53  // In order to keep non-overlapping ranges sorted, we can compare only From
54  // points.
55  bool operator<(const Range &RHS) const { return From() < RHS.From(); }
56 
57  bool operator==(const Range &RHS) const { return Impl == RHS.Impl; }
58  bool operator!=(const Range &RHS) const { return !operator==(RHS); }
59 
60 private:
61  std::pair<const llvm::APSInt *, const llvm::APSInt *> Impl;
62 };
63 
64 /// @class RangeSet is a persistent set of non-overlapping ranges.
65 ///
66 /// New RangeSet objects can be ONLY produced by RangeSet::Factory object, which
67 /// also supports the most common operations performed on range sets.
68 ///
69 /// Empty set corresponds to an overly constrained symbol meaning that there
70 /// are no possible values for that symbol.
71 class RangeSet {
72 public:
73  class Factory;
74 
75 private:
76  // We use llvm::SmallVector as the underlying container for the following
77  // reasons:
78  //
79  // * Range sets are usually very simple, 1 or 2 ranges.
80  // That's why llvm::ImmutableSet is not perfect.
81  //
82  // * Ranges in sets are NOT overlapping, so it is natural to keep them
83  // sorted for efficient operations and queries. For this reason,
84  // llvm::SmallSet doesn't fit the requirements, it is not sorted when it
85  // is a vector.
86  //
87  // * Range set operations usually a bit harder than add/remove a range.
88  // Complex operations might do many of those for just one range set.
89  // Formerly it used to be llvm::ImmutableSet, which is inefficient for our
90  // purposes as we want to make these operations BOTH immutable AND
91  // efficient.
92  //
93  // * Iteration over ranges is widespread and a more cache-friendly
94  // structure is preferred.
96 
97  struct ContainerType : public ImplType, public llvm::FoldingSetNode {
98  void Profile(llvm::FoldingSetNodeID &ID) const {
99  for (const Range &It : *this) {
100  It.Profile(ID);
101  }
102  }
103  };
104  // This is a non-owning pointer to an actual container.
105  // The memory is fully managed by the factory and is alive as long as the
106  // factory itself is alive.
107  // It is a pointer as opposed to a reference, so we can easily reassign
108  // RangeSet objects.
109  using UnderlyingType = const ContainerType *;
110  UnderlyingType Impl;
111 
112 public:
113  using const_iterator = ImplType::const_iterator;
114 
115  const_iterator begin() const { return Impl->begin(); }
116  const_iterator end() const { return Impl->end(); }
117  size_t size() const { return Impl->size(); }
118 
119  bool isEmpty() const { return Impl->empty(); }
120 
121  class Factory {
122  public:
123  Factory(BasicValueFactory &BV) : ValueFactory(BV) {}
124 
125  /// Create a new set with all ranges from both LHS and RHS.
126  /// Possible intersections are not checked here.
127  ///
128  /// Complexity: O(N + M)
129  /// where N = size(LHS), M = size(RHS)
130  RangeSet add(RangeSet LHS, RangeSet RHS);
131  /// Create a new set with all ranges from the original set plus the new one.
132  /// Possible intersections are not checked here.
133  ///
134  /// Complexity: O(N)
135  /// where N = size(Original)
136  RangeSet add(RangeSet Original, Range Element);
137  /// Create a new set with all ranges from the original set plus the point.
138  /// Possible intersections are not checked here.
139  ///
140  /// Complexity: O(N)
141  /// where N = size(Original)
142  RangeSet add(RangeSet Original, const llvm::APSInt &Point);
143 
144  RangeSet getEmptySet() { return &EmptySet; }
145 
146  /// Create a new set with just one range.
147  /// @{
148  RangeSet getRangeSet(Range Origin);
149  RangeSet getRangeSet(const llvm::APSInt &From, const llvm::APSInt &To) {
150  return getRangeSet(Range(From, To));
151  }
153  return getRangeSet(Origin, Origin);
154  }
155  /// @}
156 
157  /// Intersect the given range sets.
158  ///
159  /// Complexity: O(N + M)
160  /// where N = size(LHS), M = size(RHS)
162  /// Intersect the given set with the closed range [Lower, Upper].
163  ///
164  /// Unlike the Range type, this range uses modular arithmetic, corresponding
165  /// to the common treatment of C integer overflow. Thus, if the Lower bound
166  /// is greater than the Upper bound, the range is taken to wrap around. This
167  /// is equivalent to taking the intersection with the two ranges [Min,
168  /// Upper] and [Lower, Max], or, alternatively, /removing/ all integers
169  /// between Upper and Lower.
170  ///
171  /// Complexity: O(N)
172  /// where N = size(What)
174  /// Intersect the given range with the given point.
175  ///
176  /// The result can be either an empty set or a set containing the given
177  /// point depending on whether the point is in the range set.
178  ///
179  /// Complexity: O(logN)
180  /// where N = size(What)
182 
183  /// Delete the given point from the range set.
184  ///
185  /// Complexity: O(N)
186  /// where N = size(From)
187  RangeSet deletePoint(RangeSet From, const llvm::APSInt &Point);
188  /// Negate the given range set.
189  ///
190  /// Turn all [A, B] ranges to [-B, -A], when "-" is a C-like unary minus
191  /// operation under the values of the type.
192  ///
193  /// We also handle MIN because applying unary minus to MIN does not change
194  /// it.
195  /// Example 1:
196  /// char x = -128; // -128 is a MIN value in a range of 'char'
197  /// char y = -x; // y: -128
198  ///
199  /// Example 2:
200  /// unsigned char x = 0; // 0 is a MIN value in a range of 'unsigned char'
201  /// unsigned char y = -x; // y: 0
202  ///
203  /// And it makes us to separate the range
204  /// like [MIN, N] to [MIN, MIN] U [-N, MAX].
205  /// For instance, whole range is {-128..127} and subrange is [-128,-126],
206  /// thus [-128,-127,-126,...] negates to [-128,...,126,127].
207  ///
208  /// Negate restores disrupted ranges on bounds,
209  /// e.g. [MIN, B] => [MIN, MIN] U [-B, MAX] => [MIN, B].
210  ///
211  /// Negate is a self-inverse function, i.e. negate(negate(R)) == R.
212  ///
213  /// Complexity: O(N)
214  /// where N = size(What)
215  RangeSet negate(RangeSet What);
216 
217  /// Return associated value factory.
218  BasicValueFactory &getValueFactory() const { return ValueFactory; }
219 
220  private:
221  /// Return a persistent version of the given container.
222  RangeSet makePersistent(ContainerType &&From);
223  /// Construct a new persistent version of the given container.
224  ContainerType *construct(ContainerType &&From);
225 
226  RangeSet intersect(const ContainerType &LHS, const ContainerType &RHS);
227 
228  // Many operations include producing new APSInt values and that's why
229  // we need this factory.
230  BasicValueFactory &ValueFactory;
231  // Allocator for all the created containers.
232  // Containers might own their own memory and that's why it is specific
233  // for the type, so it calls container destructors upon deletion.
234  llvm::SpecificBumpPtrAllocator<ContainerType> Arena;
235  // Usually we deal with the same ranges and range sets over and over.
236  // Here we track all created containers and try not to repeat ourselves.
237  llvm::FoldingSet<ContainerType> Cache;
238  static ContainerType EmptySet;
239  };
240 
241  RangeSet(const RangeSet &) = default;
242  RangeSet &operator=(const RangeSet &) = default;
243  RangeSet(RangeSet &&) = default;
244  RangeSet &operator=(RangeSet &&) = default;
245  ~RangeSet() = default;
246 
247  /// Construct a new RangeSet representing '{ [From, To] }'.
248  RangeSet(Factory &F, const llvm::APSInt &From, const llvm::APSInt &To)
249  : RangeSet(F.getRangeSet(From, To)) {}
250 
251  /// Construct a new RangeSet representing the given point as a range.
252  RangeSet(Factory &F, const llvm::APSInt &Point)
253  : RangeSet(F.getRangeSet(Point)) {}
254 
255  static void Profile(llvm::FoldingSetNodeID &ID, const RangeSet &RS) {
256  ID.AddPointer(RS.Impl);
257  }
258 
259  /// Profile - Generates a hash profile of this RangeSet for use
260  /// by FoldingSet.
261  void Profile(llvm::FoldingSetNodeID &ID) const { Profile(ID, *this); }
262 
263  /// getConcreteValue - If a symbol is constrained to equal a specific integer
264  /// constant then this method returns that value. Otherwise, it returns
265  /// NULL.
267  return Impl->size() == 1 ? begin()->getConcreteValue() : nullptr;
268  }
269 
270  /// Get the minimal value covered by the ranges in the set.
271  ///
272  /// Complexity: O(1)
273  const llvm::APSInt &getMinValue() const;
274  /// Get the maximal value covered by the ranges in the set.
275  ///
276  /// Complexity: O(1)
277  const llvm::APSInt &getMaxValue() const;
278 
279  /// Test whether the given point is contained by any of the ranges.
280  ///
281  /// Complexity: O(logN)
282  /// where N = size(this)
283  bool contains(llvm::APSInt Point) const { return containsImpl(Point); }
284 
285  void dump(raw_ostream &OS) const;
286  void dump() const;
287 
288  bool operator==(const RangeSet &Other) const { return *Impl == *Other.Impl; }
289  bool operator!=(const RangeSet &Other) const { return !(*this == Other); }
290 
291 private:
292  /* implicit */ RangeSet(ContainerType *RawContainer) : Impl(RawContainer) {}
293  /* implicit */ RangeSet(UnderlyingType Ptr) : Impl(Ptr) {}
294 
295  /// Pin given points to the type represented by the current range set.
296  ///
297  /// This makes parameter points to be in-out parameters.
298  /// In order to maintain consistent types across all of the ranges in the set
299  /// and to keep all the operations to compare ONLY points of the same type, we
300  /// need to pin every point before any operation.
301  ///
302  /// @Returns true if the given points can be converted to the target type
303  /// without changing the values (i.e. trivially) and false otherwise.
304  /// @{
305  bool pin(llvm::APSInt &Lower, llvm::APSInt &Upper) const;
306  bool pin(llvm::APSInt &Point) const;
307  /// @}
308 
309  // This version of this function modifies its arguments (pins it).
310  bool containsImpl(llvm::APSInt &Point) const;
311 
312  friend class Factory;
313 };
314 
315 using ConstraintMap = llvm::ImmutableMap<SymbolRef, RangeSet>;
317 
319 public:
321  : SimpleConstraintManager(EE, SB) {}
322 
323  ~RangedConstraintManager() override;
324 
325  //===------------------------------------------------------------------===//
326  // Implementation for interface from SimpleConstraintManager.
327  //===------------------------------------------------------------------===//
328 
330  bool Assumption) override;
331 
333  const llvm::APSInt &From,
334  const llvm::APSInt &To,
335  bool InRange) override;
336 
338  bool Assumption) override;
339 
340 protected:
341  /// Assume a constraint between a symbolic expression and a concrete integer.
344  const llvm::APSInt &Int);
345 
346  //===------------------------------------------------------------------===//
347  // Interface that subclasses must implement.
348  //===------------------------------------------------------------------===//
349 
350  // Each of these is of the form "$Sym+Adj <> V", where "<>" is the comparison
351  // operation for the method being invoked.
352 
354  const llvm::APSInt &V,
355  const llvm::APSInt &Adjustment) = 0;
356 
358  const llvm::APSInt &V,
359  const llvm::APSInt &Adjustment) = 0;
360 
362  const llvm::APSInt &V,
363  const llvm::APSInt &Adjustment) = 0;
364 
366  const llvm::APSInt &V,
367  const llvm::APSInt &Adjustment) = 0;
368 
370  const llvm::APSInt &V,
371  const llvm::APSInt &Adjustment) = 0;
372 
374  const llvm::APSInt &V,
375  const llvm::APSInt &Adjustment) = 0;
376 
378  ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &From,
379  const llvm::APSInt &To, const llvm::APSInt &Adjustment) = 0;
380 
382  ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &From,
383  const llvm::APSInt &To, const llvm::APSInt &Adjustment) = 0;
384 
385  //===------------------------------------------------------------------===//
386  // Internal implementation.
387  //===------------------------------------------------------------------===//
388 private:
389  static void computeAdjustment(SymbolRef &Sym, llvm::APSInt &Adjustment);
390 };
391 
392 /// Try to simplify a given symbolic expression based on the constraints in
393 /// State. This is needed because the Environment bindings are not getting
394 /// updated when a new constraint is added to the State. If the symbol is
395 /// simplified to a non-symbol (e.g. to a constant) then the original symbol
396 /// is returned. We use this function in the family of assumeSymNE/EQ/LT/../GE
397 /// functions where we can work only with symbols. Use the other function
398 /// (simplifyToSVal) if you are interested in a simplification that may yield
399 /// a concrete constant value.
401 
402 /// Try to simplify a given symbolic expression's associated `SVal` based on the
403 /// constraints in State. This is very similar to `simplify`, but this function
404 /// always returns the simplified SVal. The simplified SVal might be a single
405 /// constant (i.e. `ConcreteInt`).
407 
408 } // namespace ento
409 } // namespace clang
410 
412 
413 #endif
clang::ento::RangeSet::contains
bool contains(llvm::APSInt Point) const
Test whether the given point is contained by any of the ranges.
Definition: RangedConstraintManager.h:283
clang::ento::BasicValueFactory
Definition: BasicValueFactory.h:108
clang::ento::RangeSet::size
size_t size() const
Definition: RangedConstraintManager.h:117
clang::ento::RangedConstraintManager::assumeSymGE
virtual ProgramStateRef assumeSymGE(ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
clang::ento::RangeSet::Factory::getEmptySet
RangeSet getEmptySet()
Definition: RangedConstraintManager.h:144
llvm::SmallVector
Definition: LLVM.h:38
clang::ento::RangeSet::~RangeSet
~RangeSet()=default
clang::ento::ProgramStateRef
IntrusiveRefCntPtr< const ProgramState > ProgramStateRef
Definition: ProgramState_Fwd.h:37
clang::ento::Range::Includes
bool Includes(const llvm::APSInt &Point) const
Definition: RangedConstraintManager.h:37
clang::ento::SymbolRef
const SymExpr * SymbolRef
Definition: SymExpr.h:110
clang::ento::RangeSet::dump
void dump() const
Definition: RangeConstraintManager.cpp:507
clang::ento::RangeSet::Factory::negate
RangeSet negate(RangeSet What)
Negate the given range set.
Definition: RangeConstraintManager.cpp:419
clang::ento::RangeSet::Factory::getValueFactory
BasicValueFactory & getValueFactory() const
Return associated value factory.
Definition: RangedConstraintManager.h:218
REGISTER_FACTORY_WITH_PROGRAMSTATE
#define REGISTER_FACTORY_WITH_PROGRAMSTATE(Type)
Declares a factory for objects of type Type in the program state manager.
Definition: ProgramStateTrait.h:52
APSInt
llvm::APSInt APSInt
Definition: ByteCodeEmitter.cpp:19
V
#define V(N, I)
Definition: ASTContext.h:3121
clang::ento::RangeSet::Factory::intersect
RangeSet intersect(RangeSet LHS, RangeSet RHS)
Intersect the given range sets.
Definition: RangeConstraintManager.cpp:403
clang::ento::Range
A Range represents the closed range [from, to].
Definition: RangedConstraintManager.h:29
clang::ento::ConstraintMap
llvm::ImmutableMap< SymbolRef, RangeSet > ConstraintMap
Definition: RangedConstraintManager.h:315
clang::ento::RangedConstraintManager
Definition: RangedConstraintManager.h:318
clang::ento::RangedConstraintManager::assumeSym
ProgramStateRef assumeSym(ProgramStateRef State, SymbolRef Sym, bool Assumption) override
Given a symbolic expression that can be reasoned about, assume that it is true/false and generate the...
Definition: RangedConstraintManager.cpp:23
clang::ento::RangeSet::operator=
RangeSet & operator=(const RangeSet &)=default
clang::ento::SymExpr
Symbolic value.
Definition: SymExpr.h:29
clang::ento::Range::Profile
void Profile(llvm::FoldingSetNodeID &ID) const
Definition: RangedConstraintManager.h:46
clang::ento::Range::To
const llvm::APSInt & To() const
Definition: RangedConstraintManager.h:41
clang::ento::RangeSet::Profile
void Profile(llvm::FoldingSetNodeID &ID) const
Profile - Generates a hash profile of this RangeSet for use by FoldingSet.
Definition: RangedConstraintManager.h:261
clang::ento::Range::Range
Range(const llvm::APSInt &From, const llvm::APSInt &To)
Definition: RangedConstraintManager.h:31
clang::ento::RangedConstraintManager::assumeSymLT
virtual ProgramStateRef assumeSymLT(ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
clang::ento::RangedConstraintManager::assumeSymLE
virtual ProgramStateRef assumeSymLE(ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
clang::ento::RangedConstraintManager::RangedConstraintManager
RangedConstraintManager(ExprEngine *EE, SValBuilder &SB)
Definition: RangedConstraintManager.h:320
clang::ento::RangeSet::operator!=
bool operator!=(const RangeSet &Other) const
Definition: RangedConstraintManager.h:289
clang::ento::RangeSet::getMinValue
const llvm::APSInt & getMinValue() const
Get the minimal value covered by the ranges in the set.
Definition: RangeConstraintManager.cpp:165
clang::ento::simplifyToSVal
SVal simplifyToSVal(ProgramStateRef State, SymbolRef Sym)
Try to simplify a given symbolic expression's associated SVal based on the constraints in State.
Definition: RangedConstraintManager.cpp:229
clang::ento::RangeSet::const_iterator
ImplType::const_iterator const_iterator
Definition: RangedConstraintManager.h:113
clang::ento::RangeSet::isEmpty
bool isEmpty() const
Definition: RangedConstraintManager.h:119
SimpleConstraintManager.h
clang::interp::InRange
bool InRange(InterpState &S, CodePtr OpPC)
Definition: Interp.h:266
clang::ento::SValBuilder
Definition: SValBuilder.h:53
clang::ento::RangeSet::getMaxValue
const llvm::APSInt & getMaxValue() const
Get the maximal value covered by the ranges in the set.
Definition: RangeConstraintManager.cpp:170
clang::ento::RangeSet::Factory::deletePoint
RangeSet deletePoint(RangeSet From, const llvm::APSInt &Point)
Delete the given point from the range set.
Definition: RangeConstraintManager.cpp:482
clang::ento::RangeSet::Profile
static void Profile(llvm::FoldingSetNodeID &ID, const RangeSet &RS)
Definition: RangedConstraintManager.h:255
clang::ento::RangedConstraintManager::assumeSymGT
virtual ProgramStateRef assumeSymGT(ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
clang::ento::RangedConstraintManager::assumeSymRel
virtual ProgramStateRef assumeSymRel(ProgramStateRef State, SymbolRef Sym, BinaryOperator::Opcode op, const llvm::APSInt &Int)
Assume a constraint between a symbolic expression and a concrete integer.
Definition: RangedConstraintManager.cpp:146
clang::ento::RangedConstraintManager::assumeSymOutsideInclusiveRange
virtual ProgramStateRef assumeSymOutsideInclusiveRange(ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &From, const llvm::APSInt &To, const llvm::APSInt &Adjustment)=0
Cache
TypePropertyCache< Private > Cache
Definition: Type.cpp:3822
clang::ento::Range::operator==
bool operator==(const Range &RHS) const
Definition: RangedConstraintManager.h:57
clang::ento::RangeSet::begin
const_iterator begin() const
Definition: RangedConstraintManager.h:115
clang::ento::RangeSet::Factory
Definition: RangedConstraintManager.h:121
clang::ento::Range::From
const llvm::APSInt & From() const
Definition: RangedConstraintManager.h:40
clang::ento::Range::dump
void dump() const
Definition: RangeConstraintManager.cpp:500
State
LineState State
Definition: UnwrappedLineFormatter.cpp:986
clang::ento::RangedConstraintManager::assumeSymUnsupported
ProgramStateRef assumeSymUnsupported(ProgramStateRef State, SymbolRef Sym, bool Assumption) override
Given a symbolic expression that cannot be reasoned about, assume that it is zero/nonzero and add it ...
Definition: RangedConstraintManager.cpp:127
clang::ento::RangeSet
Definition: RangedConstraintManager.h:71
clang::BinaryOperatorKind
BinaryOperatorKind
Definition: OperationKinds.h:25
clang::ento::RangeSet::RangeSet
RangeSet(Factory &F, const llvm::APSInt &From, const llvm::APSInt &To)
Construct a new RangeSet representing '{ [From, To] }'.
Definition: RangedConstraintManager.h:248
clang::ento::Range::getConcreteValue
const llvm::APSInt * getConcreteValue() const
Definition: RangedConstraintManager.h:42
clang::ento::ExprEngine
Definition: ExprEngine.h:127
ProgramState.h
clang::ento::Range::operator!=
bool operator!=(const Range &RHS) const
Definition: RangedConstraintManager.h:58
clang::ento::RangedConstraintManager::assumeSymWithinInclusiveRange
virtual ProgramStateRef assumeSymWithinInclusiveRange(ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &From, const llvm::APSInt &To, const llvm::APSInt &Adjustment)=0
clang::Builtin::ID
ID
Definition: Builtins.h:48
clang
Definition: CalledOnceCheck.h:17
clang::ento::RangedConstraintManager::~RangedConstraintManager
~RangedConstraintManager() override
Definition: RangedConstraintManager.cpp:21
clang::ento::RangeSet::Factory::Factory
Factory(BasicValueFactory &BV)
Definition: RangedConstraintManager.h:123
clang::ento::RangedConstraintManager::assumeSymInclusiveRange
ProgramStateRef assumeSymInclusiveRange(ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &From, const llvm::APSInt &To, bool InRange) override
Given a symbolic expression within the range [From, To], assume that it is true/false and generate th...
Definition: RangedConstraintManager.cpp:95
clang::ento::Range::operator<
bool operator<(const Range &RHS) const
Definition: RangedConstraintManager.h:55
clang::ento::RangeSet::RangeSet
RangeSet(const RangeSet &)=default
clang::ento::RangedConstraintManager::assumeSymEQ
virtual ProgramStateRef assumeSymEQ(ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
clang::ento::RangeSet::RangeSet
RangeSet(Factory &F, const llvm::APSInt &Point)
Construct a new RangeSet representing the given point as a range.
Definition: RangedConstraintManager.h:252
clang::ento::SimpleConstraintManager
Definition: SimpleConstraintManager.h:23
clang::ento::Range::Range
Range(const llvm::APSInt &Point)
Definition: RangedConstraintManager.h:35
clang::ento::RangeSet::operator==
bool operator==(const RangeSet &Other) const
Definition: RangedConstraintManager.h:288
clang::ento::RangeSet::Factory::getRangeSet
RangeSet getRangeSet(Range Origin)
Create a new set with just one range.
ProgramStateTrait.h
clang::ento::RangeSet::end
const_iterator end() const
Definition: RangedConstraintManager.h:116
clang::ento::RangeSet::Factory::add
RangeSet add(RangeSet LHS, RangeSet RHS)
Create a new set with all ranges from both LHS and RHS.
Definition: RangeConstraintManager.cpp:158
clang::ento::RangeSet::getConcreteValue
const llvm::APSInt * getConcreteValue() const
getConcreteValue - If a symbol is constrained to equal a specific integer constant then this method r...
Definition: RangedConstraintManager.h:266
clang::ento::RangedConstraintManager::assumeSymNE
virtual ProgramStateRef assumeSymNE(ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
clang::ento::RangeSet::Factory::getRangeSet
RangeSet getRangeSet(const llvm::APSInt &Origin)
Definition: RangedConstraintManager.h:152
clang::ento::getConstraintMap
ConstraintMap getConstraintMap(ProgramStateRef State)
Definition: RangeConstraintManager.cpp:1767
llvm::IntrusiveRefCntPtr
Definition: LLVM.h:47
clang::ento::RangeSet::Factory::getRangeSet
RangeSet getRangeSet(const llvm::APSInt &From, const llvm::APSInt &To)
Definition: RangedConstraintManager.h:149
clang::ento::simplify
SymbolRef simplify(ProgramStateRef State, SymbolRef Sym)
Try to simplify a given symbolic expression based on the constraints in State.
Definition: RangedConstraintManager.cpp:234