class CharUnits
Declaration
class CharUnits { /* full declaration omitted */ };
Description
CharUnits - This is an opaque type for sizes expressed in character units. Instances of this type represent a quantity as a multiple of the size of the standard C type, char, on the target architecture. As an opaque type, CharUnits protects you from accidentally combining operations on quantities in bit units and character units. In both C and C++, an object of type 'char', 'signed char', or 'unsigned char' occupies exactly one byte, so 'character unit' and 'byte' refer to the same quantity of storage. However, we use the term 'character unit' rather than 'byte' to avoid an implication that a character unit is exactly 8 bits. For portability, never assume that a target character is 8 bits wide. Use CharUnit values wherever you calculate sizes, offsets, or alignments in character units.
Declared at: clang/include/clang/AST/CharUnits.h:38
Member Variables
- private clang::CharUnits::QuantityType Quantity = 0
Method Overview
- public CharUnits()
- private CharUnits(clang::CharUnits::QuantityType C)
- public static clang::CharUnits One()
- public static clang::CharUnits Zero()
- public clang::CharUnits alignTo(const clang::CharUnits & Align) const
- public clang::CharUnits alignmentAtOffset(clang::CharUnits offset) const
- public clang::CharUnits alignmentOfArrayElement(clang::CharUnits elementSize) const
- public static clang::CharUnits fromQuantity(clang::CharUnits::QuantityType Quantity)
- public llvm::Align getAsAlign() const
- public llvm::MaybeAlign getAsMaybeAlign() const
- public clang::CharUnits::QuantityType getQuantity() const
- public bool isMultipleOf(clang::CharUnits N) const
- public bool isNegative() const
- public bool isOne() const
- public bool isPositive() const
- public bool isPowerOfTwo() const
- public bool isZero() const
Methods
¶CharUnits()
CharUnits()
Description
CharUnits - A default constructor.
Declared at: clang/include/clang/AST/CharUnits.h:50
¶CharUnits(clang::CharUnits::QuantityType C)
CharUnits(clang::CharUnits::QuantityType C)
Declared at: clang/include/clang/AST/CharUnits.h:45
Parameters
- clang::CharUnits::QuantityType C
¶static clang::CharUnits One()
static clang::CharUnits One()
Description
One - Construct a CharUnits quantity of one.
Declared at: clang/include/clang/AST/CharUnits.h:58
¶static clang::CharUnits Zero()
static clang::CharUnits Zero()
Description
Zero - Construct a CharUnits quantity of zero.
Declared at: clang/include/clang/AST/CharUnits.h:53
¶clang::CharUnits alignTo(
const clang::CharUnits& Align) const
clang::CharUnits alignTo(
const clang::CharUnits& Align) const
Description
alignTo - Returns the next integer (mod 2**64) that is greater than or equal to this quantity and is a multiple of \p Align. Align must be non-zero.
Declared at: clang/include/clang/AST/CharUnits.h:194
Parameters
- const clang::CharUnits& Align
¶clang::CharUnits alignmentAtOffset(
clang::CharUnits offset) const
clang::CharUnits alignmentAtOffset(
clang::CharUnits offset) const
Description
Given that this is a non-zero alignment value, what is the alignment at the given offset?
Declared at: clang/include/clang/AST/CharUnits.h:200
Parameters
- clang::CharUnits offset
¶clang::CharUnits alignmentOfArrayElement(
clang::CharUnits elementSize) const
clang::CharUnits alignmentOfArrayElement(
clang::CharUnits elementSize) const
Description
Given that this is the alignment of the first element of an array, return the minimum alignment of any element in the array.
Declared at: clang/include/clang/AST/CharUnits.h:207
Parameters
- clang::CharUnits elementSize
¶static clang::CharUnits fromQuantity(
clang::CharUnits::QuantityType Quantity)
static clang::CharUnits fromQuantity(
clang::CharUnits::QuantityType Quantity)
Description
fromQuantity - Construct a CharUnits quantity from a raw integer type.
Declared at: clang/include/clang/AST/CharUnits.h:63
Parameters
- clang::CharUnits::QuantityType Quantity
¶llvm::Align getAsAlign() const
llvm::Align getAsAlign() const
Description
getAsAlign - Returns Quantity as a valid llvm::Align, Beware llvm::Align assumes power of two 8-bit bytes.
Declared at: clang/include/clang/AST/CharUnits.h:183
¶llvm::MaybeAlign getAsMaybeAlign() const
llvm::MaybeAlign getAsMaybeAlign() const
Description
getAsMaybeAlign - Returns Quantity as a valid llvm::Align or llvm::None, Beware llvm::MaybeAlign assumes power of two 8-bit bytes.
Declared at: clang/include/clang/AST/CharUnits.h:187
¶clang::CharUnits::QuantityType getQuantity() const
clang::CharUnits::QuantityType getQuantity() const
Description
getQuantity - Get the raw integer representation of this quantity.
Declared at: clang/include/clang/AST/CharUnits.h:179
¶bool isMultipleOf(clang::CharUnits N) const
bool isMultipleOf(clang::CharUnits N) const
Description
Test whether this is a multiple of the other value. Among other things, this promises that self.alignTo(N) will just return self.
Declared at: clang/include/clang/AST/CharUnits.h:137
Parameters
¶bool isNegative() const
bool isNegative() const
Description
isNegative - Test whether the quantity is less than zero.
Declared at: clang/include/clang/AST/CharUnits.h:125
¶bool isOne() const
bool isOne() const
Description
isOne - Test whether the quantity equals one.
Declared at: clang/include/clang/AST/CharUnits.h:119
¶bool isPositive() const
bool isPositive() const
Description
isPositive - Test whether the quantity is greater than zero.
Declared at: clang/include/clang/AST/CharUnits.h:122
¶bool isPowerOfTwo() const
bool isPowerOfTwo() const
Description
isPowerOfTwo - Test whether the quantity is a power of two. Zero is not a power of two.
Declared at: clang/include/clang/AST/CharUnits.h:129
¶bool isZero() const
bool isZero() const
Description
isZero - Test whether the quantity equals zero.
Declared at: clang/include/clang/AST/CharUnits.h:116