clang 20.0.0git
|
#include "clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h"
Public Member Functions | |
Factory (BasicValueFactory &BV) | |
RangeSet | add (RangeSet LHS, RangeSet RHS) |
Create a new set with all ranges from both LHS and RHS. | |
RangeSet | add (RangeSet Original, Range Element) |
Create a new set with all ranges from the original set plus the new one. | |
RangeSet | add (RangeSet Original, const llvm::APSInt &Point) |
Create a new set with all ranges from the original set plus the point. | |
RangeSet | unite (RangeSet LHS, RangeSet RHS) |
Create a new set which is a union of two given ranges. | |
RangeSet | unite (RangeSet Original, Range Element) |
Create a new set by uniting given range set with the given range. | |
RangeSet | unite (RangeSet Original, llvm::APSInt Point) |
Create a new set by uniting given range set with the given point. | |
RangeSet | unite (RangeSet Original, llvm::APSInt From, llvm::APSInt To) |
Create a new set by uniting given range set with the given range between points. | |
RangeSet | getEmptySet () |
RangeSet | intersect (RangeSet LHS, RangeSet RHS) |
Intersect the given range sets. | |
RangeSet | intersect (RangeSet What, llvm::APSInt Lower, llvm::APSInt Upper) |
Intersect the given set with the closed range [Lower, Upper]. | |
RangeSet | intersect (RangeSet What, llvm::APSInt Point) |
Intersect the given range with the given point. | |
RangeSet | deletePoint (RangeSet From, const llvm::APSInt &Point) |
Delete the given point from the range set. | |
RangeSet | negate (RangeSet What) |
Negate the given range set. | |
RangeSet | castTo (RangeSet What, APSIntType Ty) |
Performs promotions, truncations and conversions of the given set. | |
RangeSet | castTo (RangeSet What, QualType T) |
BasicValueFactory & | getValueFactory () const |
Return associated value factory. | |
RangeSet | getRangeSet (Range Origin) |
Create a new set with just one range. | |
RangeSet | getRangeSet (const llvm::APSInt &From, const llvm::APSInt &To) |
RangeSet | getRangeSet (const llvm::APSInt &Origin) |
Definition at line 121 of file RangedConstraintManager.h.
|
inline |
Definition at line 123 of file RangedConstraintManager.h.
Create a new set with all ranges from both LHS and RHS.
Possible intersections are not checked here.
Complexity: O(N + M) where N = size(LHS), M = size(RHS)
Definition at line 114 of file RangeConstraintManager.cpp.
References clang::ento::RangeSet::begin(), clang::ento::RangeSet::end(), clang::Result, and clang::ento::RangeSet::size().
Create a new set with all ranges from the original set plus the point.
Possible intersections are not checked here.
Complexity: O(N) where N = size(Original)
Definition at line 134 of file RangeConstraintManager.cpp.
Create a new set with all ranges from the original set plus the new one.
Possible intersections are not checked here.
Complexity: O(N) where N = size(Original)
Definition at line 122 of file RangeConstraintManager.cpp.
References clang::Result.
RangeSet RangeSet::Factory::castTo | ( | RangeSet | What, |
APSIntType | Ty | ||
) |
Performs promotions, truncations and conversions of the given set.
This function is optimized for each of the six cast cases:
NOTE: This function is NOT self-inverse for truncations, because of the higher bits loss:
Complexity:
Definition at line 676 of file RangeConstraintManager.cpp.
References clang::ento::RangeSet::getAPSIntType(), clang::ento::APSIntType::getBitWidth(), clang::ento::RangeSet::getBitWidth(), clang::ento::RangeSet::isEmpty(), clang::ento::APSIntType::isUnsigned(), and clang::ento::RangeSet::isUnsigned().
Definition at line 707 of file RangeConstraintManager.cpp.
References clang::ento::RangeSet::getAPSIntType(), clang::Type::isIntegralOrEnumerationType(), and clang::T.
Delete the given point from the range set.
Complexity: O(N) where N = size(From)
Definition at line 849 of file RangeConstraintManager.cpp.
References clang::ento::RangeSet::contains().
|
inline |
Definition at line 168 of file RangedConstraintManager.h.
|
inline |
Definition at line 173 of file RangedConstraintManager.h.
References getRangeSet().
|
inline |
Definition at line 176 of file RangedConstraintManager.h.
References getRangeSet().
Create a new set with just one range.
Definition at line 318 of file RangeConstraintManager.cpp.
References clang::Result.
Referenced by getRangeSet().
|
inline |
Return associated value factory.
Definition at line 265 of file RangedConstraintManager.h.
Intersect the given range sets.
Complexity: O(N + M) where N = size(LHS), M = size(RHS)
Definition at line 595 of file RangeConstraintManager.cpp.
References clang::ento::RangeSet::getMaxValue(), clang::ento::RangeSet::getMinValue(), and clang::ento::RangeSet::isEmpty().
Intersect the given set with the closed range [Lower, Upper].
Unlike the Range type, this range uses modular arithmetic, corresponding to the common treatment of C integer overflow. Thus, if the Lower bound is greater than the Upper bound, the range is taken to wrap around. This is equivalent to taking the intersection with the two ranges [Min, Upper] and [Lower, Max], or, alternatively, /removing/ all integers between Upper and Lower.
Complexity: O(N) where N = size(What)
Definition at line 474 of file RangeConstraintManager.cpp.
References clang::ento::RangeSet::getMaxValue(), clang::ento::RangeSet::getMinValue(), and clang::ento::RangeSet::isEmpty().
Intersect the given range with the given point.
The result can be either an empty set or a set containing the given point depending on whether the point is in the range set.
Complexity: O(logN) where N = size(What)
Definition at line 604 of file RangeConstraintManager.cpp.
Negate the given range set.
Turn all [A, B] ranges to [-B, -A], when "-" is a C-like unary minus operation under the values of the type.
We also handle MIN because applying unary minus to MIN does not change it. Example 1: char x = -128; // -128 is a MIN value in a range of 'char' char y = -x; // y: -128
Example 2: unsigned char x = 0; // 0 is a MIN value in a range of 'unsigned char' unsigned char y = -x; // y: 0
And it makes us to separate the range like [MIN, N] to [MIN, MIN] U [-N, MAX]. For instance, whole range is {-128..127} and subrange is [-128,-126], thus [-128,-127,-126,...] negates to [-128,...,126,127].
Negate restores disrupted ranges on bounds, e.g. [MIN, B] => [MIN, MIN] U [-B, MAX] => [MIN, B].
Negate is a self-inverse function, i.e. negate(negate(R)) == R.
Complexity: O(N) where N = size(What)
Definition at line 611 of file RangeConstraintManager.cpp.
References clang::ento::RangeSet::begin(), clang::ento::RangeSet::end(), clang::ento::RangeSet::getMinValue(), clang::ento::RangeSet::isEmpty(), clang::Last, clang::Result, and clang::ento::RangeSet::size().
Create a new set which is a union of two given ranges.
Possible intersections are not checked here.
Complexity: O(N + M) where N = size(LHS), M = size(RHS)
Definition at line 138 of file RangeConstraintManager.cpp.
References clang::Result.
Create a new set by uniting given range set with the given range between points.
All intersections and adjacent ranges are handled here.
Complexity: O(N) where N = size(Original)
Definition at line 154 of file RangeConstraintManager.cpp.
Create a new set by uniting given range set with the given point.
All intersections and adjacent ranges are handled here.
Complexity: O(N) where N = size(Original)
Definition at line 150 of file RangeConstraintManager.cpp.
Create a new set by uniting given range set with the given range.
All intersections and adjacent ranges are handled here.
Complexity: O(N) where N = size(Original)
Definition at line 143 of file RangeConstraintManager.cpp.
References clang::Result.