|
LLVM
4.0.0
|
A sum type over pointer-like types. More...
#include <PointerSumType.h>
Public Member Functions | |
| PointerSumType () | |
| TagT | getTag () const |
| template<TagT N> | |
| bool | is () const |
| template<TagT N> | |
| HelperT::template Lookup< N > ::PointerT | get () const |
| template<TagT N> | |
| HelperT::template Lookup< N > ::PointerT | cast () const |
| operator bool () const | |
| bool | operator== (const PointerSumType &R) const |
| bool | operator!= (const PointerSumType &R) const |
| bool | operator< (const PointerSumType &R) const |
| bool | operator> (const PointerSumType &R) const |
| bool | operator<= (const PointerSumType &R) const |
| bool | operator>= (const PointerSumType &R) const |
| uintptr_t | getOpaqueValue () const |
Static Public Member Functions | |
| template<TagT N> | |
| static PointerSumType | create (typename HelperT::template Lookup< N >::PointerT Pointer) |
| A typed constructor for a specific tagged member of the sum type. More... | |
Protected Member Functions | |
| void * | getImpl () const |
A sum type over pointer-like types.
This is a normal tagged union across pointer-like types that uses the low bits of the pointers to store the tag.
Each member of the sum type is specified by passing a PointerSumTypeMember specialization in the variadic member argument list. This allows the user to control the particular tag value associated with a particular type, use the same type for multiple different tags, and customize the pointer-like traits used for a particular member. Note that these must be specializations of PointerSumTypeMember, no other type will suffice, even if it provides a compatible interface.
This type implements all of the comparison operators and even hash table support by comparing the underlying storage of the pointer values. It doesn't support delegating to particular members for comparisons.
It also default constructs to a zero tag with a null pointer, whatever that would be. This means that the zero value for the tag type is significant and may be desirable to set to a state that is particularly desirable to default construct.
There is no support for constructing or accessing with a dynamic tag as that would fundamentally violate the type safety provided by the sum type.
Definition at line 62 of file PointerSumType.h.
|
inline |
Definition at line 68 of file PointerSumType.h.
|
inline |
Definition at line 92 of file PointerSumType.h.
|
inlinestatic |
A typed constructor for a specific tagged member of the sum type.
Definition at line 73 of file PointerSumType.h.
|
inline |
Definition at line 86 of file PointerSumType.h.
|
inlineprotected |
Definition at line 108 of file PointerSumType.h.
Referenced by llvm::PointerSumType< DepType, PointerSumTypeMember< Invalid, Instruction * >, PointerSumTypeMember< Clobber, Instruction * >, PointerSumTypeMember< Def, Instruction * >, PointerSumTypeMember< Other, PointerEmbeddedInt< OtherType, 3 > > >::cast(), and llvm::PointerSumType< DepType, PointerSumTypeMember< Invalid, Instruction * >, PointerSumTypeMember< Clobber, Instruction * >, PointerSumTypeMember< Def, Instruction * >, PointerSumTypeMember< Other, PointerEmbeddedInt< OtherType, 3 > > >::get().
|
inline |
Definition at line 105 of file PointerSumType.h.
Referenced by llvm::DenseMapInfo< PointerSumType< TagT, MemberTs...> >::getHashValue().
|
inline |
Definition at line 82 of file PointerSumType.h.
|
inline |
Definition at line 84 of file PointerSumType.h.
|
inlineexplicit |
Definition at line 97 of file PointerSumType.h.
|
inline |
Definition at line 99 of file PointerSumType.h.
|
inline |
Definition at line 100 of file PointerSumType.h.
|
inline |
Definition at line 102 of file PointerSumType.h.
|
inline |
Definition at line 98 of file PointerSumType.h.
|
inline |
Definition at line 101 of file PointerSumType.h.
|
inline |
Definition at line 103 of file PointerSumType.h.
1.8.6