class RangeSet::Factory

Declaration

class RangeSet::Factory { /* full declaration omitted */ };

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:121

Member Variables

private clang::ento::BasicValueFactory& ValueFactory
private llvm::SpecificBumpPtrAllocator<ContainerType> Arena
private llvm::FoldingSet<ContainerType> Cache
private static clang::ento::RangeSet::ContainerType EmptySet

Method Overview

  • public Factory(clang::ento::BasicValueFactory & BV)
  • public clang::ento::RangeSet add(clang::ento::RangeSet LHS, clang::ento::RangeSet RHS)
  • public clang::ento::RangeSet add(clang::ento::RangeSet Original, clang::ento::Range Element)
  • public clang::ento::RangeSet add(clang::ento::RangeSet Original, const llvm::APSInt & Point)
  • public clang::ento::RangeSet castTo(clang::ento::RangeSet What, clang::QualType T)
  • public clang::ento::RangeSet castTo(clang::ento::RangeSet What, clang::ento::APSIntType Ty)
  • private clang::ento::RangeSet::ContainerType * construct(clang::ento::RangeSet::ContainerType && From)
  • private clang::ento::RangeSet::ContainerType convertTo(clang::ento::RangeSet What, clang::ento::APSIntType Ty)
  • public clang::ento::RangeSet deletePoint(clang::ento::RangeSet From, const llvm::APSInt & Point)
  • public clang::ento::RangeSet getEmptySet()
  • public clang::ento::RangeSet getRangeSet(clang::ento::Range Origin)
  • public clang::ento::RangeSet getRangeSet(const llvm::APSInt & From, const llvm::APSInt & To)
  • public clang::ento::RangeSet getRangeSet(const llvm::APSInt & Origin)
  • public clang::ento::BasicValueFactory & getValueFactory() const
  • public clang::ento::RangeSet intersect(clang::ento::RangeSet What, llvm::APSInt Lower, llvm::APSInt Upper)
  • private clang::ento::RangeSet intersect(const clang::ento::RangeSet::ContainerType & LHS, const clang::ento::RangeSet::ContainerType & RHS)
  • public clang::ento::RangeSet intersect(clang::ento::RangeSet What, llvm::APSInt Point)
  • public clang::ento::RangeSet intersect(clang::ento::RangeSet LHS, clang::ento::RangeSet RHS)
  • private clang::ento::RangeSet makePersistent(clang::ento::RangeSet::ContainerType && From)
  • public clang::ento::RangeSet negate(clang::ento::RangeSet What)
  • private clang::ento::RangeSet::ContainerType promoteTo(clang::ento::RangeSet What, clang::ento::APSIntType Ty)
  • private clang::ento::RangeSet::ContainerType truncateTo(clang::ento::RangeSet What, clang::ento::APSIntType Ty)
  • public clang::ento::RangeSet unite(clang::ento::RangeSet Original, llvm::APSInt From, llvm::APSInt To)
  • public clang::ento::RangeSet unite(clang::ento::RangeSet Original, llvm::APSInt Point)
  • public clang::ento::RangeSet unite(clang::ento::RangeSet Original, clang::ento::Range Element)
  • private clang::ento::RangeSet::ContainerType unite(const clang::ento::RangeSet::ContainerType & LHS, const clang::ento::RangeSet::ContainerType & RHS)
  • public clang::ento::RangeSet unite(clang::ento::RangeSet LHS, clang::ento::RangeSet RHS)

Methods

Factory(clang::ento::BasicValueFactory& BV)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:123

Parameters

clang::ento::BasicValueFactory& BV

clang::ento::RangeSet add(
    clang::ento::RangeSet LHS,
    clang::ento::RangeSet RHS)

Description

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)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:130

Parameters

clang::ento::RangeSet LHS
clang::ento::RangeSet RHS

clang::ento::RangeSet add(
    clang::ento::RangeSet Original,
    clang::ento::Range Element)

Description

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)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:136

Parameters

clang::ento::RangeSet Original
clang::ento::Range Element

clang::ento::RangeSet add(
    clang::ento::RangeSet Original,
    const llvm::APSInt& Point)

Description

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)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:142

Parameters

clang::ento::RangeSet Original
const llvm::APSInt& Point

clang::ento::RangeSet castTo(
    clang::ento::RangeSet What,
    clang::QualType T)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:262

Parameters

clang::ento::RangeSet What
clang::QualType T

clang::ento::RangeSet castTo(
    clang::ento::RangeSet What,
    clang::ento::APSIntType Ty)

Description

Performs promotions, truncations and conversions of the given set. This function is optimized for each of the six cast cases: - noop - conversion - truncation - truncation-conversion - promotion - promotion-conversion NOTE: This function is NOT self-inverse for truncations, because of the higher bits loss: - castTo(castTo(OrigRangeOfInt, char), int) != OrigRangeOfInt. - castTo(castTo(OrigRangeOfChar, int), char) == OrigRangeOfChar. But it is self-inverse for all the rest casts. Complexity: - Noop O(1); - Truncation O(N^2); - Another case O(N); where N = size(What)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:261

Parameters

clang::ento::RangeSet What
clang::ento::APSIntType Ty

clang::ento::RangeSet::ContainerType* construct(
    clang::ento::RangeSet::ContainerType&& From)

Description

Construct a new persistent version of the given container.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:271

Parameters

clang::ento::RangeSet::ContainerType&& From

clang::ento::RangeSet::ContainerType convertTo(
    clang::ento::RangeSet What,
    clang::ento::APSIntType Ty)

Description

This is a helper function for `castTo` method. Implies not to be used separately. Performs a conversion case and a promotion-conversion case for signeds of a cast operation.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:287

Parameters

clang::ento::RangeSet What
clang::ento::APSIntType Ty

clang::ento::RangeSet deletePoint(
    clang::ento::RangeSet From,
    const llvm::APSInt& Point)

Description

Delete the given point from the range set. Complexity: O(N) where N = size(From)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:211

Parameters

clang::ento::RangeSet From
const llvm::APSInt& Point

clang::ento::RangeSet getEmptySet()

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:168

clang::ento::RangeSet getRangeSet(
    clang::ento::Range Origin)

Description

Create a new set with just one range. @ {

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:172

Parameters

clang::ento::Range Origin

clang::ento::RangeSet getRangeSet(
    const llvm::APSInt& From,
    const llvm::APSInt& To)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:173

Parameters

const llvm::APSInt& From
const llvm::APSInt& To

clang::ento::RangeSet getRangeSet(
    const llvm::APSInt& Origin)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:176

Parameters

const llvm::APSInt& Origin

clang::ento::BasicValueFactory& getValueFactory()
    const

Description

Return associated value factory.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:265

clang::ento::RangeSet intersect(
    clang::ento::RangeSet What,
    llvm::APSInt Lower,
    llvm::APSInt Upper)

Description

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)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:197

Parameters

clang::ento::RangeSet What
llvm::APSInt Lower
llvm::APSInt Upper

clang::ento::RangeSet intersect(
    const clang::ento::RangeSet::ContainerType&
        LHS,
    const clang::ento::RangeSet::ContainerType&
        RHS)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:273

Parameters

const clang::ento::RangeSet::ContainerType& LHS
const clang::ento::RangeSet::ContainerType& RHS

clang::ento::RangeSet intersect(
    clang::ento::RangeSet What,
    llvm::APSInt Point)

Description

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)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:205

Parameters

clang::ento::RangeSet What
llvm::APSInt Point

clang::ento::RangeSet intersect(
    clang::ento::RangeSet LHS,
    clang::ento::RangeSet RHS)

Description

Intersect the given range sets. Complexity: O(N + M) where N = size(LHS), M = size(RHS)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:185

Parameters

clang::ento::RangeSet LHS
clang::ento::RangeSet RHS

clang::ento::RangeSet makePersistent(
    clang::ento::RangeSet::ContainerType&& From)

Description

Return a persistent version of the given container.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:269

Parameters

clang::ento::RangeSet::ContainerType&& From

clang::ento::RangeSet negate(
    clang::ento::RangeSet What)

Description

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)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:239

Parameters

clang::ento::RangeSet What

clang::ento::RangeSet::ContainerType promoteTo(
    clang::ento::RangeSet What,
    clang::ento::APSIntType Ty)

Description

This is a helper function for `castTo` method. Implies not to be used separately. Performs a promotion for unsigneds only.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:292

Parameters

clang::ento::RangeSet What
clang::ento::APSIntType Ty

clang::ento::RangeSet::ContainerType truncateTo(
    clang::ento::RangeSet What,
    clang::ento::APSIntType Ty)

Description

This is a helper function for `castTo` method. Implies not to be used separately. Performs a truncation case of a cast operation.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:281

Parameters

clang::ento::RangeSet What
clang::ento::APSIntType Ty

clang::ento::RangeSet unite(
    clang::ento::RangeSet Original,
    llvm::APSInt From,
    llvm::APSInt To)

Description

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)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:166

Parameters

clang::ento::RangeSet Original
llvm::APSInt From
llvm::APSInt To

clang::ento::RangeSet unite(
    clang::ento::RangeSet Original,
    llvm::APSInt Point)

Description

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)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:160

Parameters

clang::ento::RangeSet Original
llvm::APSInt Point

clang::ento::RangeSet unite(
    clang::ento::RangeSet Original,
    clang::ento::Range Element)

Description

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)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:154

Parameters

clang::ento::RangeSet Original
clang::ento::Range Element

clang::ento::RangeSet::ContainerType unite(
    const clang::ento::RangeSet::ContainerType&
        LHS,
    const clang::ento::RangeSet::ContainerType&
        RHS)

Description

NOTE: This function relies on the fact that all values in the containers are persistent (created via BasicValueFactory::getValue).

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:276

Parameters

const clang::ento::RangeSet::ContainerType& LHS
const clang::ento::RangeSet::ContainerType& RHS

clang::ento::RangeSet unite(
    clang::ento::RangeSet LHS,
    clang::ento::RangeSet RHS)

Description

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)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:148

Parameters

clang::ento::RangeSet LHS
clang::ento::RangeSet RHS