class Integral

Declaration

template <unsigned int Bits, bool Signed>
class Integral { /* full declaration omitted */ };

Description

Wrapper around numeric types. These wrappers are required to shared an interface between APSint and builtin primitive numeral types, while optimising for storage and allowing methods operating on primitive type to compile to fast code.

Declared at: clang/lib/AST/Interp/Integral.h:56

Templates

unsigned int Bits
bool Signed

Member Variables

private clang::interp::Integral::T V
private static const auto Min = std::numeric_limits<typename Repr<Bits, Signed>::Type>::min()
Primitive representing limits.
private static const auto Max = std::numeric_limits<typename Repr<Bits, Signed>::Type>::max()

Method Overview

  • private template <typename T>static std::enable_if_t<std::is_unsigned<T>::value, bool> CheckAddUB(T A, T B, T & R)
  • private template <typename T>static std::enable_if_t<std::is_signed<T>::value, bool> CheckAddUB(T A, T B, T & R)
  • private template <typename T>static std::enable_if_t<std::is_unsigned<T>::value, bool> CheckMulUB(T A, T B, T & R)
  • private template <typename T>static std::enable_if_t<std::is_signed<T>::value, bool> CheckMulUB(T A, T B, T & R)
  • private template <typename T, T Min, T Max>static std::enable_if_t<std::is_unsigned<T>::value, bool> CheckRange(int64_t V)
  • private template <typename T, T Min, T Max>static std::enable_if_t<std::is_signed<T>::value, bool> CheckRange(int64_t V)
  • private template <typename T>static std::enable_if_t<std::is_unsigned<T>::value, bool> CheckSubUB(T A, T B, T & R)
  • private template <typename T>static std::enable_if_t<std::is_signed<T>::value, bool> CheckSubUB(T A, T B, T & R)
  • public Integral<Bits, Signed>(const clang::interp::APSInt & V)
  • public template <unsigned int SrcBits, bool SrcSign> Integral<Bits, Signed>(Integral<SrcBits, SrcSign> V)
  • private template <typename T> Integral<Bits, Signed>(T V)
  • public Integral<Bits, Signed>()
  • public static bool add(Integral<Bits, Signed> A, Integral<Bits, Signed> B, unsigned int OpBits, Integral<Bits, Signed> * R)
  • public static constexpr unsigned int bitWidth()
  • public clang::ComparisonCategoryResult compare(const Integral<Bits, Signed> & RHS) const
  • public unsigned int countLeadingZeros() const
  • public static bool decrement(Integral<Bits, Signed> A, Integral<Bits, Signed> * R)
  • public template <typename T>static Integral<Bits, Signed> from(T Value, unsigned int NumBits)
  • public template <bool SrcSign>static Integral<Bits, Signed> from(Integral<0, SrcSign> Value)
  • public template <unsigned int SrcBits, bool SrcSign>static std::enable_if_t<SrcBits != 0, Integral<Bits, Signed>> from(Integral<SrcBits, SrcSign> Value)
  • public template <typename T>static std::enable_if_t<std::is_integral<T>::value, Integral<Bits, Signed>> from(T Value)
  • public static bool inRange(int64_t Value, unsigned int NumBits)
  • public static bool increment(Integral<Bits, Signed> A, Integral<Bits, Signed> * R)
  • public bool isMin() const
  • public bool isMinusOne() const
  • public bool isNegative() const
  • public bool isPositive() const
  • public static constexpr bool isSigned()
  • public bool isZero() const
  • public static Integral<Bits, Signed> max(unsigned int NumBits)
  • public static Integral<Bits, Signed> min(unsigned int NumBits)
  • public static bool mul(Integral<Bits, Signed> A, Integral<Bits, Signed> B, unsigned int OpBits, Integral<Bits, Signed> * R)
  • public template <unsigned int DstBits, bool DstSign>Integral<DstBits, DstSign> operator Integral<SrcBits, SrcSign>() const
  • public int64_t operator long() const
  • public unsigned int operator unsigned int() const
  • public uint64_t operator unsigned long() const
  • public void print(llvm::raw_ostream & OS) const
  • public static bool sub(Integral<Bits, Signed> A, Integral<Bits, Signed> B, unsigned int OpBits, Integral<Bits, Signed> * R)
  • public clang::interp::APSInt toAPSInt(unsigned int NumBits) const
  • public clang::interp::APSInt toAPSInt() const
  • public clang::APValue toAPValue() const
  • public Integral<Bits, false> toUnsigned() const
  • public Integral<Bits, Signed> truncate(unsigned int TruncBits) const
  • public static Integral<Bits, Signed> zero()

Methods

template <typename T>
static std::
    enable_if_t<std::is_unsigned<T>::value, bool>
    CheckAddUB(T A, T B, T& R)

Declared at: clang/lib/AST/Interp/Integral.h:214

Templates

T

Parameters

T A
T B
T& R

template <typename T>
static std::enable_if_t<std::is_signed<T>::value,
                        bool>
CheckAddUB(T A, T B, T& R)

Declared at: clang/lib/AST/Interp/Integral.h:208

Templates

T

Parameters

T A
T B
T& R

template <typename T>
static std::
    enable_if_t<std::is_unsigned<T>::value, bool>
    CheckMulUB(T A, T B, T& R)

Declared at: clang/lib/AST/Interp/Integral.h:240

Templates

T

Parameters

T A
T B
T& R

template <typename T>
static std::enable_if_t<std::is_signed<T>::value,
                        bool>
CheckMulUB(T A, T B, T& R)

Declared at: clang/lib/AST/Interp/Integral.h:234

Templates

T

Parameters

T A
T B
T& R

template <typename T, T Min, T Max>
static std::
    enable_if_t<std::is_unsigned<T>::value, bool>
    CheckRange(int64_t V)

Declared at: clang/lib/AST/Interp/Integral.h:254

Templates

T
T Min
T Max

Parameters

int64_t V

template <typename T, T Min, T Max>
static std::enable_if_t<std::is_signed<T>::value,
                        bool>
CheckRange(int64_t V)

Declared at: clang/lib/AST/Interp/Integral.h:248

Templates

T
T Min
T Max

Parameters

int64_t V

template <typename T>
static std::
    enable_if_t<std::is_unsigned<T>::value, bool>
    CheckSubUB(T A, T B, T& R)

Declared at: clang/lib/AST/Interp/Integral.h:227

Templates

T

Parameters

T A
T B
T& R

template <typename T>
static std::enable_if_t<std::is_signed<T>::value,
                        bool>
CheckSubUB(T A, T B, T& R)

Declared at: clang/lib/AST/Interp/Integral.h:221

Templates

T

Parameters

T A
T B
T& R

Integral<Bits, Signed>(
    const clang::interp::APSInt& V)

Description

Construct an integral from a value based on signedness.

Declared at: clang/lib/AST/Interp/Integral.h:80

Parameters

const clang::interp::APSInt& V

template <unsigned int SrcBits, bool SrcSign>
Integral<Bits, Signed>(
    Integral<SrcBits, SrcSign> V)

Description

Constructs an integral from another integral.

Declared at: clang/lib/AST/Interp/Integral.h:77

Templates

unsigned int SrcBits
bool SrcSign

Parameters

Integral<SrcBits, SrcSign> V

template <typename T>
Integral<Bits, Signed>(T V)

Description

Construct an integral from anything that is convertible to storage.

Declared at: clang/lib/AST/Interp/Integral.h:69

Templates

T

Parameters

T V

Integral<Bits, Signed>()

Description

Zero-initializes an integral.

Declared at: clang/lib/AST/Interp/Integral.h:73

static bool add(Integral<Bits, Signed> A,
                Integral<Bits, Signed> B,
                unsigned int OpBits,
                Integral<Bits, Signed>* R)

Declared at: clang/lib/AST/Interp/Integral.h:194

Parameters

Integral<Bits, Signed> A
Integral<Bits, Signed> B
unsigned int OpBits
Integral<Bits, Signed>* R

static constexpr unsigned int bitWidth()

Declared at: clang/lib/AST/Interp/Integral.h:121

clang::ComparisonCategoryResult compare(
    const Integral<Bits, Signed>& RHS) const

Declared at: clang/lib/AST/Interp/Integral.h:134

Parameters

const Integral<Bits, Signed>& RHS

unsigned int countLeadingZeros() const

Declared at: clang/lib/AST/Interp/Integral.h:138

static bool decrement(Integral<Bits, Signed> A,
                      Integral<Bits, Signed>* R)

Declared at: clang/lib/AST/Interp/Integral.h:190

Parameters

Integral<Bits, Signed> A
Integral<Bits, Signed>* R

template <typename T>
static Integral<Bits, Signed> from(
    T Value,
    unsigned int NumBits)

Declared at: clang/lib/AST/Interp/Integral.h:178

Templates

T

Parameters

T Value
unsigned int NumBits

template <bool SrcSign>
static Integral<Bits, Signed> from(
    Integral<0, SrcSign> Value)

Declared at: clang/lib/AST/Interp/Integral.h:169

Templates

bool SrcSign

Parameters

Integral<0, SrcSign> Value

template <unsigned int SrcBits, bool SrcSign>
static std::enable_if_t<SrcBits != 0,
                        Integral<Bits, Signed>>
from(Integral<SrcBits, SrcSign> Value)

Declared at: clang/lib/AST/Interp/Integral.h:165

Templates

unsigned int SrcBits
bool SrcSign

Parameters

Integral<SrcBits, SrcSign> Value

template <typename T>
static std::enable_if_t<
    std::is_integral<T>::value,
    Integral<Bits, Signed>>
from(T Value)

Declared at: clang/lib/AST/Interp/Integral.h:159

Templates

T

Parameters

T Value

static bool inRange(int64_t Value,
                    unsigned int NumBits)

Declared at: clang/lib/AST/Interp/Integral.h:182

Parameters

int64_t Value
unsigned int NumBits

static bool increment(Integral<Bits, Signed> A,
                      Integral<Bits, Signed>* R)

Declared at: clang/lib/AST/Interp/Integral.h:186

Parameters

Integral<Bits, Signed> A
Integral<Bits, Signed>* R

bool isMin() const

Declared at: clang/lib/AST/Interp/Integral.h:125

bool isMinusOne() const

Declared at: clang/lib/AST/Interp/Integral.h:127

bool isNegative() const

Declared at: clang/lib/AST/Interp/Integral.h:131

bool isPositive() const

Declared at: clang/lib/AST/Interp/Integral.h:132

static constexpr bool isSigned()

Declared at: clang/lib/AST/Interp/Integral.h:129

bool isZero() const

Declared at: clang/lib/AST/Interp/Integral.h:123

static Integral<Bits, Signed> max(
    unsigned int NumBits)

Declared at: clang/lib/AST/Interp/Integral.h:154

Parameters

unsigned int NumBits

static Integral<Bits, Signed> min(
    unsigned int NumBits)

Declared at: clang/lib/AST/Interp/Integral.h:151

Parameters

unsigned int NumBits

static bool mul(Integral<Bits, Signed> A,
                Integral<Bits, Signed> B,
                unsigned int OpBits,
                Integral<Bits, Signed>* R)

Declared at: clang/lib/AST/Interp/Integral.h:202

Parameters

Integral<Bits, Signed> A
Integral<Bits, Signed> B
unsigned int OpBits
Integral<Bits, Signed>* R

template <unsigned int DstBits, bool DstSign>
Integral<DstBits, DstSign>
operator Integral<SrcBits, SrcSign>() const

Declared at: clang/lib/AST/Interp/Integral.h:98

Templates

unsigned int DstBits
bool DstSign

int64_t operator long() const

Declared at: clang/lib/AST/Interp/Integral.h:103

unsigned int operator unsigned int() const

Declared at: clang/lib/AST/Interp/Integral.h:102

uint64_t operator unsigned long() const

Declared at: clang/lib/AST/Interp/Integral.h:104

void print(llvm::raw_ostream& OS) const

Declared at: clang/lib/AST/Interp/Integral.h:149

Parameters

llvm::raw_ostream& OS

static bool sub(Integral<Bits, Signed> A,
                Integral<Bits, Signed> B,
                unsigned int OpBits,
                Integral<Bits, Signed>* R)

Declared at: clang/lib/AST/Interp/Integral.h:198

Parameters

Integral<Bits, Signed> A
Integral<Bits, Signed> B
unsigned int OpBits
Integral<Bits, Signed>* R

clang::interp::APSInt toAPSInt(
    unsigned int NumBits) const

Declared at: clang/lib/AST/Interp/Integral.h:109

Parameters

unsigned int NumBits

clang::interp::APSInt toAPSInt() const

Declared at: clang/lib/AST/Interp/Integral.h:106

clang::APValue toAPValue() const

Declared at: clang/lib/AST/Interp/Integral.h:115

Integral<Bits, false> toUnsigned() const

Declared at: clang/lib/AST/Interp/Integral.h:117

Integral<Bits, Signed> truncate(
    unsigned int TruncBits) const

Declared at: clang/lib/AST/Interp/Integral.h:140

Parameters

unsigned int TruncBits

static Integral<Bits, Signed> zero()

Declared at: clang/lib/AST/Interp/Integral.h:176