|
My Project
|
#include <TypeSwitch.h>


Public Types | |
| using | BaseT = detail::TypeSwitchBase< TypeSwitch< T, ResultT >, T > |
Public Member Functions | |
| TypeSwitch (TypeSwitch &&other)=default | |
| template<typename CaseT , typename CallableT > | |
| TypeSwitch< T, ResultT > & | Case (CallableT &&caseFn) |
| Add a case on the given type. More... | |
| template<typename CallableT > | |
| LLVM_NODISCARD ResultT | Default (CallableT &&defaultFn) |
| As a default, invoke the given callable within the root value. More... | |
| LLVM_NODISCARD | operator ResultT () |
Public Member Functions inherited from mlir::detail::TypeSwitchBase< TypeSwitch< T, ResultT >, T > | |
| TypeSwitchBase (const T &value) | |
| TypeSwitchBase (TypeSwitchBase &&other) | |
| TypeSwitchBase (const TypeSwitchBase &)=delete | |
| TypeSwitchBase is not copyable. More... | |
| ~TypeSwitchBase ()=default | |
| void | operator= (const TypeSwitchBase &)=delete |
| void | operator= (TypeSwitchBase &&other)=delete |
| TypeSwitch< T, ResultT > & | Case (CallableT &&caseFn) |
| Invoke a case on the derived class with multiple case types. More... | |
| TypeSwitch< T, ResultT > & | Case (CallableT &&caseFn) |
Additional Inherited Members | |
Protected Types inherited from mlir::detail::TypeSwitchBase< TypeSwitch< T, ResultT >, T > | |
| using | has_dyn_cast_t = decltype(std::declval< ValueT &>().template dyn_cast< CastT >()) |
Static Protected Member Functions inherited from mlir::detail::TypeSwitchBase< TypeSwitch< T, ResultT >, T > | |
| static auto | castValue (ValueT value, typename std::enable_if_t< is_detected< has_dyn_cast_t, ValueT, CastT >::value > *=nullptr) |
| static auto | castValue (ValueT value, typename std::enable_if_t< !is_detected< has_dyn_cast_t, ValueT, CastT >::value > *=nullptr) |
Protected Attributes inherited from mlir::detail::TypeSwitchBase< TypeSwitch< T, ResultT >, T > | |
| const T | value |
| The root value we are switching on. More... | |
This class implements a switch-like dispatch statement for a value of 'T' using dyn_cast functionality. Each Case<T> takes a callable to be invoked if the root value isa<T>, the callable is invoked with the result of dyn_cast<T>() as a parameter.
Example: Operation *op = ...; LogicalResult result = TypeSwitch<Operation *, LogicalResult>(op) .Case<ConstantOp>([](ConstantOp op) { ... }) .Default([](Operation *op) { ... });
| using mlir::TypeSwitch< T, ResultT >::BaseT = detail::TypeSwitchBase<TypeSwitch<T, ResultT>, T> |
|
default |
|
inline |
Add a case on the given type.
|
inline |
As a default, invoke the given callable within the root value.
|
inline |
1.8.13