9#ifndef CLANG_BASIC_CUSTOMIZABLEOPTIONAL_H
10#define CLANG_BASIC_CUSTOMIZABLEOPTIONAL_H
12#include "llvm/ADT/Hashing.h"
13#include "llvm/Support/Compiler.h"
14#include "llvm/Support/type_traits.h"
22namespace optional_detail {
41 : Storage(
std::in_place,
std::move(y)) {}
44 template <
typename... ArgTypes>
55 Storage = std::move(y);
61 template <
typename... ArgTypes>
void emplace(ArgTypes &&...Args) {
62 Storage.emplace(std::forward<ArgTypes>(Args)...);
71 void reset() { Storage.reset(); }
73 LLVM_DEPRECATED(
"Use &*X instead.",
"&*X")
74 constexpr const
T *
getPointer()
const {
return &Storage.value(); }
75 LLVM_DEPRECATED(
"Use &*X instead.",
"&*X")
77 LLVM_DEPRECATED(
"std::optional::value is throwing. Use *X instead",
"*X")
78 constexpr const
T &
value() const & {
return Storage.value(); }
79 LLVM_DEPRECATED(
"std::optional::value is throwing. Use *X instead",
"*X")
80 T &
value() & {
return Storage.value(); }
83 constexpr bool has_value()
const {
return Storage.has_value(); }
84 constexpr const T *
operator->()
const {
return &Storage.value(); }
86 constexpr const T &
operator*() const & {
return Storage.value(); }
89 template <
typename U>
constexpr T value_or(
U &&alt)
const & {
93 LLVM_DEPRECATED(
"std::optional::value is throwing. Use *X instead",
"*X")
94 T &&
value() && {
return std::move(Storage.value()); }
95 T &&
operator*() && {
return std::move(Storage.value()); }
98 return has_value() ? std::move(
operator*()) : std::forward<U>(alt);
110template <
typename T,
typename U>
118template <
typename T,
typename U>
124template <
typename T,
typename U>
132template <
typename T,
typename U>
138template <
typename T,
typename U>
144template <
typename T,
typename U>
157 return X == std::nullopt;
162 return !(
X == std::nullopt);
167 return X != std::nullopt;
177 return X.has_value();
182 return !(std::nullopt <
X);
187 return !(
X < std::nullopt);
192 return std::nullopt <
X;
197 return X < std::nullopt;
202 return std::nullopt <=
X;
207 return X <= std::nullopt;
constexpr CustomizableOptional(std::in_place_t, ArgTypes &&...Args)
constexpr T value_or(U &&alt) const &
CustomizableOptional & operator=(const CustomizableOptional &O)=default
constexpr CustomizableOptional(T &&y)
void emplace(ArgTypes &&...Args)
Create a new object by constructing it in place with the given arguments.
constexpr bool has_value() const
constexpr CustomizableOptional(const CustomizableOptional &O)=default
constexpr CustomizableOptional(std::nullopt_t)
constexpr const T * operator->() const
CustomizableOptional & operator=(const T &y)
constexpr CustomizableOptional(std::optional< T > &&y)
constexpr const T & operator*() const &
CustomizableOptional & operator=(CustomizableOptional &&O)=default
CustomizableOptional & operator=(T &&y)
constexpr CustomizableOptional(const std::optional< T > &y)
constexpr const T & value() const &
constexpr CustomizableOptional()=default
constexpr CustomizableOptional(CustomizableOptional &&O)=default
constexpr const T * getPointer() const
constexpr CustomizableOptional(const T &y)
The JSON file list parser is used to communicate input to InstallAPI.
bool operator==(const CallGraphNode::CallRecord &LHS, const CallGraphNode::CallRecord &RHS)
bool operator<(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
bool operator!=(CanQual< T > x, CanQual< U > y)
bool operator<=(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
llvm::hash_code hash_value(const CustomizableOptional< T > &O)
bool operator>(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
const FunctionProtoType * T
bool operator>=(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
hash_code hash_value(const clang::tooling::dependencies::ModuleID &ID)