16 #ifndef LLVM_ADT_OPTIONAL_H 17 #define LLVM_ADT_OPTIONAL_H 30 namespace optional_detail {
44 new (storage.
buffer)
T(std::forward<T>(y));
48 new (storage.
buffer)
T(std::move(*
O.getPointer()));
56 new (storage.
buffer)
T(std::move(y));
65 *
this = std::move(*
O.getPointer());
103 return reinterpret_cast<T *
>(storage.
buffer);
107 return reinterpret_cast<const T *
>(storage.
buffer);
113 template <
typename T>
class Optional {
129 Storage = std::move(y);
135 template <
typename... ArgTypes>
void emplace(ArgTypes &&...
Args) {
171 template <
typename U>
173 return hasValue() ? getValue() : std::forward<U>(value);
176 #if LLVM_HAS_RVALUE_REFERENCE_THIS 177 T &&getValue() && {
return std::move(*
getPointer()); }
180 template <
typename U>
181 T getValueOr(U &&value) && {
182 return hasValue() ? std::move(getValue()) : std::forward<U>(value);
192 template <
typename T,
typename U>
199 template <
typename T,
typename U>
204 template <
typename T,
typename U>
208 return X.hasValue() < Y.hasValue();
211 template <
typename T,
typename U>
216 template <
typename T,
typename U>
221 template <
typename T,
typename U>
246 template <
typename T>
bool operator<(const Optional<T> &
X,
NoneType) {
250 template <
typename T>
bool operator<(NoneType, const Optional<T> &
X) {
254 template <
typename T>
bool operator<=(const Optional<T> &
X,
NoneType) {
258 template <
typename T>
bool operator<=(NoneType, const Optional<T> &
X) {
294 template <
typename T>
bool operator<(const Optional<T> &
X,
const T &
Y) {
298 template <
typename T>
bool operator<(const T &X, const Optional<T> &
Y) {
302 template <
typename T>
bool operator<=(const Optional<T> &
X,
const T &
Y) {
306 template <
typename T>
bool operator<=(const T &X, const Optional<T> &
Y) {
328 #endif // LLVM_ADT_OPTIONAL_H #define LLVM_LVALUE_FUNCTION
Expands to '&' if ref-qualifiers for *this are supported.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
const T & operator*() const LLVM_LVALUE_FUNCTION
This class represents lattice values for constants.
NoneType
A simple null object to allow implicit construction of Optional<T> and similar types without having t...
OptionalStorage & operator=(const T &y)
bool operator>(int64_t V1, const APSInt &V2)
constexpr T getValueOr(U &&value) const LLVM_LVALUE_FUNCTION
void emplace(ArgTypes &&... Args)
Create a new object by constructing it in place with the given arguments.
block Block Frequency true
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
OptionalStorage(OptionalStorage &&O)
OptionalStorage & operator=(T &&y)
T & getValue() LLVM_LVALUE_FUNCTION
bool operator>=(int64_t V1, const APSInt &V2)
Optional & operator=(const T &y)
APInt operator*(APInt a, uint64_t RHS)
AlignedCharArrayUnion< T > storage
const T & getValue() const LLVM_LVALUE_FUNCTION
const T * operator->() const
OptionalStorage & operator=(const OptionalStorage &O)
static Optional create(const T *y)
OptionalStorage()=default
T & operator*() LLVM_LVALUE_FUNCTION
const T * getPointer() const
const T * getPointer() const
constexpr Optional(NoneType)
isPodLike - This is a type trait that is used to determine whether a given type can be copied around ...
OptionalStorage & operator=(OptionalStorage &&O)
OptionalStorage(const T &y)
bool operator!=(uint64_t V1, const APInt &V2)
Optional & operator=(T &&y)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
OptionalStorage(const OptionalStorage &O)
bool operator==(uint64_t V1, const APInt &V2)
constexpr char Args[]
Key for Kernel::Metadata::mArgs.