llvm::MaybeAlign

This struct is a compact representation of a valid (power of two) or undefined (0) alignment.

Synopsis

Declared in <llvm/Support/Alignment.h>

struct MaybeAlign;

Description

Inherits the optional storage privately and re-exports the public std::optional interface with documentation.

Type Aliases

NameDescription
value_type Contained alignment type when set.

Member Functions

NameDescription
MaybeAlign [constructor]Constructors
operator= Assignment operators
valueOrOne For convenience, returns a valid alignment or 1 if undefined.

Using Declarations

NameDescription
and_then Chains a continuation when an alignment is set.
emplace Constructs an alignment in place.
has_value Returns whether an alignment value is present.
operator bool True when an alignment is set.
operator* Accesses the stored alignment.
operator-> Accesses members of the stored alignment.
operator= Assigns from another optional alignment.
or_else Supplies an alternate optional when unset.
reset Clears any stored alignment.
swap Swaps the contained alignment with another optional.
transform Transforms the stored alignment when set.
value Returns the alignment or throws if unset.
value_or Returns the alignment, or a fallback when unset.

Non-Member Functions

NameDescription
DebugStrFormat optional alignment MA as a decimal string or "None" for debug logging.
decodeMaybeAlignDual operation of the encode function above.
encodeReturns a representation of the alignment that encodes undefined as 0.
operator!=Return true if optional alignment Lhs is set.
operator!=Return true if optional alignments Lhs and Rhs differ.
operator!=Return true if optional alignment Lhs is unset or differs from Rhs.
operator<Relational less-than is deleted for MaybeAlign vs Align.
operator<Relational less-than is deleted for MaybeAlign vs MaybeAlign.
operator<=Relational less-or-equal is deleted for MaybeAlign vs MaybeAlign.
operator<=Relational less-or-equal is deleted for MaybeAlign vs Align.
operator==Return true if optional alignment Lhs is set and equals Rhs.
operator==Return true if optional alignments Lhs and Rhs are both unset or equal.
operator==Return true if optional alignment Lhs is unset.
operator>Relational greater-than is deleted for MaybeAlign; compare Align values instead.
operator>Relational greater-than is deleted for MaybeAlign vs Align.
operator>=Relational greater-or-equal is deleted for MaybeAlign vs Align.
operator>=Relational greater-or-equal is deleted for MaybeAlign vs MaybeAlign.