13 #ifndef LLVM_CLANG_AST_CHARUNITS_H 14 #define LLVM_CLANG_AST_CHARUNITS_H 16 #include "llvm/ADT/DenseMapInfo.h" 17 #include "llvm/Support/Alignment.h" 18 #include "llvm/Support/DataTypes.h" 19 #include "llvm/Support/MathExtras.h" 43 QuantityType Quantity = 0;
45 explicit CharUnits(QuantityType
C) : Quantity(C) {}
69 Quantity += Other.Quantity;
80 Quantity -= Other.Quantity;
93 return Quantity == Other.Quantity;
96 return Quantity != Other.Quantity;
101 return Quantity < Other.Quantity;
104 return Quantity <= Other.Quantity;
107 return Quantity > Other.Quantity;
110 return Quantity >= Other.Quantity;
116 bool isZero()
const {
return Quantity == 0; }
119 bool isOne()
const {
return Quantity == 1; }
130 return (Quantity & -Quantity) == Quantity;
138 return (*
this % N) == 0;
157 return Quantity / Other.Quantity;
163 return Quantity % Other.Quantity;
166 return CharUnits(Quantity + Other.Quantity);
169 return CharUnits(Quantity - Other.Quantity);
183 llvm::Align
getAsAlign()
const {
return llvm::Align(Quantity); }
189 return CharUnits(llvm::alignTo(Quantity, Align.Quantity));
195 assert(Quantity != 0 &&
"offsetting from unknown alignment?");
196 return CharUnits(llvm::MinAlign(Quantity, offset.Quantity));
247 #endif // LLVM_CLANG_AST_CHARUNITS_H
CharUnits alignTo(const CharUnits &Align) const
alignTo - Returns the next integer (mod 2**64) that is greater than or equal to this quantity and is ...
Specialize PointerLikeTypeTraits to allow LazyGenerationalUpdatePtr to be placed into a PointerUnion...
static clang::CharUnits getTombstoneKey()
bool isZero() const
isZero - Test whether the quantity equals zero.
CharUnits()=default
CharUnits - A default constructor.
bool isPowerOfTwo() const
isPowerOfTwo - Test whether the quantity is a power of two.
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
CharUnits & operator*=(QuantityType N)
CharUnits - This is an opaque type for sizes expressed in character units.
llvm::Align getAsAlign() const
getAsAlign - Returns Quantity as a valid llvm::Align, Beware llvm::Align assumes power of two 8-bit b...
CharUnits operator%(QuantityType N) const
bool isOne() const
isOne - Test whether the quantity equals one.
CharUnits operator/(QuantityType N) const
bool isNegative() const
isNegative - Test whether the quantity is less than zero.
static bool isEqual(const clang::CharUnits &LHS, const clang::CharUnits &RHS)
static CharUnits One()
One - Construct a CharUnits quantity of one.
CharUnits & operator+=(const CharUnits &Other)
static clang::CharUnits getEmptyKey()
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
bool operator<(const CharUnits &Other) const
bool isPositive() const
isPositive - Test whether the quantity is greater than zero.
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
CharUnits operator-() const
bool operator<=(const CharUnits &Other) const
CharUnits alignmentOfArrayElement(CharUnits elementSize) const
Given that this is the alignment of the first element of an array, return the minimum alignment of an...
CharUnits alignmentAtOffset(CharUnits offset) const
Given that this is a non-zero alignment value, what is the alignment at the given offset...
Dataflow Directional Tag Classes.
CharUnits & operator-=(const CharUnits &Other)
CharUnits operator+(const CharUnits &Other) const
bool operator==(const CharUnits &Other) const
CharUnits & operator/=(QuantityType N)
bool isMultipleOf(CharUnits N) const
Test whether this is a multiple of the other value.
bool operator!=(const CharUnits &Other) const
static unsigned getHashValue(const clang::CharUnits &CU)
bool operator>(const CharUnits &Other) const
CharUnits operator*(QuantityType N) const
bool operator>=(const CharUnits &Other) const