clang  10.0.0svn
Public Member Functions | Static Public Member Functions | Friends | List of all members
clang::interp::Integral< Bits, Signed > Class Template Reference

Wrapper around numeric types. More...

#include "/opt/doxygen-docs/src/llvm/tools/clang/lib/AST/Interp/Integral.h"

Public Member Functions

 Integral ()
 Zero-initializes an integral. More...
 
template<unsigned SrcBits, bool SrcSign>
 Integral (Integral< SrcBits, SrcSign > V)
 Constructs an integral from another integral. More...
 
 Integral (const APSInt &V)
 Construct an integral from a value based on signedness. More...
 
bool operator< (Integral RHS) const
 
bool operator> (Integral RHS) const
 
bool operator<= (Integral RHS) const
 
bool operator>= (Integral RHS) const
 
bool operator== (Integral RHS) const
 
bool operator!= (Integral RHS) const
 
bool operator> (unsigned RHS) const
 
Integral operator- () const
 
Integral operator~ () const
 
template<unsigned DstBits, bool DstSign>
 operator Integral< DstBits, DstSign > () const
 
 operator unsigned () const
 
 operator int64_t () const
 
 operator uint64_t () const
 
APSInt toAPSInt () const
 
APSInt toAPSInt (unsigned NumBits) const
 
APValue toAPValue () const
 
Integral< Bits, falsetoUnsigned () const
 
bool isZero () const
 
bool isMin () const
 
bool isMinusOne () const
 
bool isNegative () const
 
bool isPositive () const
 
ComparisonCategoryResult compare (const Integral &RHS) const
 
unsigned countLeadingZeros () const
 
Integral truncate (unsigned TruncBits) const
 
void print (llvm::raw_ostream &OS) const
 

Static Public Member Functions

static constexpr unsigned bitWidth ()
 
static constexpr bool isSigned ()
 
static Integral min (unsigned NumBits)
 
static Integral max (unsigned NumBits)
 
template<typename T >
static std::enable_if< std::is_integral< T >::value, Integral >::type from (T Value)
 
template<unsigned SrcBits, bool SrcSign>
static std::enable_if< SrcBits !=0, Integral >::type from (Integral< SrcBits, SrcSign > Value)
 
template<bool SrcSign>
static Integral from (Integral< 0, SrcSign > Value)
 
static Integral zero ()
 
template<typename T >
static Integral from (T Value, unsigned NumBits)
 
static bool inRange (int64_t Value, unsigned NumBits)
 
static bool increment (Integral A, Integral *R)
 
static bool decrement (Integral A, Integral *R)
 
static bool add (Integral A, Integral B, unsigned OpBits, Integral *R)
 
static bool sub (Integral A, Integral B, unsigned OpBits, Integral *R)
 
static bool mul (Integral A, Integral B, unsigned OpBits, Integral *R)
 

Friends

template<unsigned OtherBits, bool OtherSigned>
class Integral
 

Detailed Description

template<unsigned Bits, bool Signed>
class clang::interp::Integral< Bits, Signed >

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.

Definition at line 56 of file Integral.h.

Constructor & Destructor Documentation

◆ Integral() [1/3]

template<unsigned Bits, bool Signed>
clang::interp::Integral< Bits, Signed >::Integral ( )
inline

Zero-initializes an integral.

Definition at line 73 of file Integral.h.

◆ Integral() [2/3]

template<unsigned Bits, bool Signed>
template<unsigned SrcBits, bool SrcSign>
clang::interp::Integral< Bits, Signed >::Integral ( Integral< SrcBits, SrcSign >  V)
inlineexplicit

Constructs an integral from another integral.

Definition at line 77 of file Integral.h.

◆ Integral() [3/3]

template<unsigned Bits, bool Signed>
clang::interp::Integral< Bits, Signed >::Integral ( const APSInt V)
inlineexplicit

Construct an integral from a value based on signedness.

Definition at line 80 of file Integral.h.

Member Function Documentation

◆ add()

template<unsigned Bits, bool Signed>
static bool clang::interp::Integral< Bits, Signed >::add ( Integral< Bits, Signed >  A,
Integral< Bits, Signed >  B,
unsigned  OpBits,
Integral< Bits, Signed > *  R 
)
inlinestatic

Definition at line 195 of file Integral.h.

◆ bitWidth()

template<unsigned Bits, bool Signed>
static constexpr unsigned clang::interp::Integral< Bits, Signed >::bitWidth ( )
inlinestatic

◆ compare()

template<unsigned Bits, bool Signed>
ComparisonCategoryResult clang::interp::Integral< Bits, Signed >::compare ( const Integral< Bits, Signed > &  RHS) const
inline

Definition at line 134 of file Integral.h.

References clang::interp::Compare().

◆ countLeadingZeros()

template<unsigned Bits, bool Signed>
unsigned clang::interp::Integral< Bits, Signed >::countLeadingZeros ( ) const
inline

Definition at line 138 of file Integral.h.

References V.

◆ decrement()

template<unsigned Bits, bool Signed>
static bool clang::interp::Integral< Bits, Signed >::decrement ( Integral< Bits, Signed >  A,
Integral< Bits, Signed > *  R 
)
inlinestatic

Definition at line 191 of file Integral.h.

References clang::interp::Integral< Bits, Signed >::bitWidth().

◆ from() [1/4]

template<unsigned Bits, bool Signed>
template<typename T >
static std::enable_if<std::is_integral<T>::value, Integral>::type clang::interp::Integral< Bits, Signed >::from ( Value)
inlinestatic

Definition at line 160 of file Integral.h.

References clang::ast_matchers::type.

◆ from() [2/4]

template<unsigned Bits, bool Signed>
template<unsigned SrcBits, bool SrcSign>
static std::enable_if<SrcBits != 0, Integral>::type clang::interp::Integral< Bits, Signed >::from ( Integral< SrcBits, SrcSign >  Value)
inlinestatic

Definition at line 166 of file Integral.h.

◆ from() [3/4]

template<unsigned Bits, bool Signed>
template<bool SrcSign>
static Integral clang::interp::Integral< Bits, Signed >::from ( Integral< 0, SrcSign >  Value)
inlinestatic

Definition at line 170 of file Integral.h.

◆ from() [4/4]

template<unsigned Bits, bool Signed>
template<typename T >
static Integral clang::interp::Integral< Bits, Signed >::from ( Value,
unsigned  NumBits 
)
inlinestatic

Definition at line 179 of file Integral.h.

◆ increment()

template<unsigned Bits, bool Signed>
static bool clang::interp::Integral< Bits, Signed >::increment ( Integral< Bits, Signed >  A,
Integral< Bits, Signed > *  R 
)
inlinestatic

Definition at line 187 of file Integral.h.

References clang::interp::Integral< Bits, Signed >::bitWidth().

◆ inRange()

template<unsigned Bits, bool Signed>
static bool clang::interp::Integral< Bits, Signed >::inRange ( int64_t  Value,
unsigned  NumBits 
)
inlinestatic

Definition at line 183 of file Integral.h.

◆ isMin()

template<unsigned Bits, bool Signed>
bool clang::interp::Integral< Bits, Signed >::isMin ( ) const
inline

Definition at line 125 of file Integral.h.

References min().

◆ isMinusOne()

template<unsigned Bits, bool Signed>
bool clang::interp::Integral< Bits, Signed >::isMinusOne ( ) const
inline

Definition at line 127 of file Integral.h.

◆ isNegative()

template<unsigned Bits, bool Signed>
bool clang::interp::Integral< Bits, Signed >::isNegative ( ) const
inline

Definition at line 131 of file Integral.h.

◆ isPositive()

template<unsigned Bits, bool Signed>
bool clang::interp::Integral< Bits, Signed >::isPositive ( ) const
inline

Definition at line 132 of file Integral.h.

◆ isSigned()

template<unsigned Bits, bool Signed>
static constexpr bool clang::interp::Integral< Bits, Signed >::isSigned ( )
inlinestatic

Definition at line 129 of file Integral.h.

◆ isZero()

template<unsigned Bits, bool Signed>
bool clang::interp::Integral< Bits, Signed >::isZero ( ) const
inline

Definition at line 123 of file Integral.h.

References V.

Referenced by clang::interp::Boolean::from().

◆ max()

template<unsigned Bits, bool Signed>
static Integral clang::interp::Integral< Bits, Signed >::max ( unsigned  NumBits)
inlinestatic

Definition at line 154 of file Integral.h.

◆ min()

template<unsigned Bits, bool Signed>
static Integral clang::interp::Integral< Bits, Signed >::min ( unsigned  NumBits)
inlinestatic

Definition at line 151 of file Integral.h.

◆ mul()

template<unsigned Bits, bool Signed>
static bool clang::interp::Integral< Bits, Signed >::mul ( Integral< Bits, Signed >  A,
Integral< Bits, Signed >  B,
unsigned  OpBits,
Integral< Bits, Signed > *  R 
)
inlinestatic

Definition at line 203 of file Integral.h.

References clang::interp::CheckRange(), and V.

◆ operator int64_t()

template<unsigned Bits, bool Signed>
clang::interp::Integral< Bits, Signed >::operator int64_t ( ) const
inlineexplicit

Definition at line 103 of file Integral.h.

References V.

◆ operator Integral< DstBits, DstSign >()

template<unsigned Bits, bool Signed>
template<unsigned DstBits, bool DstSign>
clang::interp::Integral< Bits, Signed >::operator Integral< DstBits, DstSign > ( ) const
inlineexplicit

Definition at line 98 of file Integral.h.

References V.

◆ operator uint64_t()

template<unsigned Bits, bool Signed>
clang::interp::Integral< Bits, Signed >::operator uint64_t ( ) const
inlineexplicit

Definition at line 104 of file Integral.h.

References V.

◆ operator unsigned()

template<unsigned Bits, bool Signed>
clang::interp::Integral< Bits, Signed >::operator unsigned ( ) const
inlineexplicit

Definition at line 102 of file Integral.h.

References V.

◆ operator!=()

template<unsigned Bits, bool Signed>
bool clang::interp::Integral< Bits, Signed >::operator!= ( Integral< Bits, Signed >  RHS) const
inline

Definition at line 88 of file Integral.h.

◆ operator-()

template<unsigned Bits, bool Signed>
Integral clang::interp::Integral< Bits, Signed >::operator- ( ) const
inline

Definition at line 94 of file Integral.h.

◆ operator<()

template<unsigned Bits, bool Signed>
bool clang::interp::Integral< Bits, Signed >::operator< ( Integral< Bits, Signed >  RHS) const
inline

Definition at line 83 of file Integral.h.

◆ operator<=()

template<unsigned Bits, bool Signed>
bool clang::interp::Integral< Bits, Signed >::operator<= ( Integral< Bits, Signed >  RHS) const
inline

Definition at line 85 of file Integral.h.

◆ operator==()

template<unsigned Bits, bool Signed>
bool clang::interp::Integral< Bits, Signed >::operator== ( Integral< Bits, Signed >  RHS) const
inline

Definition at line 87 of file Integral.h.

◆ operator>() [1/2]

template<unsigned Bits, bool Signed>
bool clang::interp::Integral< Bits, Signed >::operator> ( Integral< Bits, Signed >  RHS) const
inline

Definition at line 84 of file Integral.h.

◆ operator>() [2/2]

template<unsigned Bits, bool Signed>
bool clang::interp::Integral< Bits, Signed >::operator> ( unsigned  RHS) const
inline

Definition at line 90 of file Integral.h.

References V.

◆ operator>=()

template<unsigned Bits, bool Signed>
bool clang::interp::Integral< Bits, Signed >::operator>= ( Integral< Bits, Signed >  RHS) const
inline

Definition at line 86 of file Integral.h.

◆ operator~()

template<unsigned Bits, bool Signed>
Integral clang::interp::Integral< Bits, Signed >::operator~ ( ) const
inline

Definition at line 95 of file Integral.h.

◆ print()

template<unsigned Bits, bool Signed>
void clang::interp::Integral< Bits, Signed >::print ( llvm::raw_ostream &  OS) const
inline

Definition at line 149 of file Integral.h.

References V.

◆ sub()

template<unsigned Bits, bool Signed>
static bool clang::interp::Integral< Bits, Signed >::sub ( Integral< Bits, Signed >  A,
Integral< Bits, Signed >  B,
unsigned  OpBits,
Integral< Bits, Signed > *  R 
)
inlinestatic

Definition at line 199 of file Integral.h.

◆ toAPSInt() [1/2]

template<unsigned Bits, bool Signed>
APSInt clang::interp::Integral< Bits, Signed >::toAPSInt ( ) const
inline

Definition at line 106 of file Integral.h.

◆ toAPSInt() [2/2]

template<unsigned Bits, bool Signed>
APSInt clang::interp::Integral< Bits, Signed >::toAPSInt ( unsigned  NumBits) const
inline

Definition at line 109 of file Integral.h.

◆ toAPValue()

template<unsigned Bits, bool Signed>
APValue clang::interp::Integral< Bits, Signed >::toAPValue ( ) const
inline

Definition at line 115 of file Integral.h.

◆ toUnsigned()

template<unsigned Bits, bool Signed>
Integral<Bits, false> clang::interp::Integral< Bits, Signed >::toUnsigned ( ) const
inline

Definition at line 117 of file Integral.h.

◆ truncate()

template<unsigned Bits, bool Signed>
Integral clang::interp::Integral< Bits, Signed >::truncate ( unsigned  TruncBits) const
inline

Definition at line 140 of file Integral.h.

◆ zero()

template<unsigned Bits, bool Signed>
static Integral clang::interp::Integral< Bits, Signed >::zero ( )
inlinestatic

Definition at line 177 of file Integral.h.

Friends And Related Function Documentation

◆ Integral

template<unsigned Bits, bool Signed>
template<unsigned OtherBits, bool OtherSigned>
friend class Integral
friend

Definition at line 58 of file Integral.h.


The documentation for this class was generated from the following file: