36 template <
typename T>
struct TypeId {
static char Id; };
39 virtual ~StorageBase() =
default;
40 virtual std::unique_ptr<StorageBase> clone()
const = 0;
41 virtual const void *id()
const = 0;
44 template <
typename T>
struct StorageImpl :
public StorageBase {
49 std::unique_ptr<StorageBase> clone()
const override {
50 return std::make_unique<StorageImpl<T>>(
Value);
53 const void *id()
const override {
return &TypeId<T>::Id; }
58 StorageImpl &operator=(
const StorageImpl &
Other) =
delete;
59 StorageImpl(
const StorageImpl &
Other) =
delete;
66 : Storage(
Other.Storage ?
Other.Storage->clone() : nullptr) {}
74 std::negation<std::is_same<std::decay_t<T>,
Any>>,
85 std::negation<std::is_convertible<Any, std::decay_t<T>>>,
86 std::is_copy_constructible<std::decay_t<T>>>
::value,
90 std::make_unique<StorageImpl<std::decay_t<T>>>(std::forward<T>(
Value));
101 Storage = std::move(
Other.Storage);
111 template <
typename T>
bool isa()
const {
114 return Storage->id() == &Any::TypeId<remove_cvref_t<T>>::Id;
117 template <
class T>
friend T any_cast(
const Any &Value);
118 template <
class T>
friend T any_cast(Any &Value);
119 template <
class T>
friend T any_cast(Any &&Value);
120 template <
class T>
friend const T *any_cast(
const Any *Value);
121 template <
class T>
friend T *any_cast(Any *Value);
124 std::unique_ptr<StorageBase> Storage;
136template <
typename T>
char Any::TypeId<T>::Id = 1;
140 return static_cast<T>(*any_cast<remove_cvref_t<T>>(&
Value));
145 return static_cast<T>(*any_cast<remove_cvref_t<T>>(&
Value));
157 return &
static_cast<Any::StorageImpl<U> &
>(*
Value->Storage).
Value;
161 using U = std::decay_t<T>;
164 return &
static_cast<Any::StorageImpl<U> &
>(*
Value->Storage).
Value;
Given that RA is a live value
std::optional< std::vector< StOtherPiece > > Other
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file contains library features backported from future STL versions.
Any & operator=(Any Other)
friend bool any_isa(const Any &Value)
LLVM Value Representation.
This is an optimization pass for GlobalISel generic memory operations.
T any_cast(const Any &Value)
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Implement std::hash so that hash_code can be used in STL containers.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.