A switch()-like dispatch on a value of type T using dyn_cast.
Declared in <llvm/ADT/TypeSwitch.h>
template<
typename T,
typename ResultT = void>
class TypeSwitch
: public /* implementation-defined */
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>([]op) { ... }) .Default([]*op) { ... });
| Name | Description |
|---|---|
/* implementation-defined */ |
| Name | Description |
|---|---|
BaseT | CRTP base that provides Case() helpers for this TypeSwitch. |
| Name | Description |
|---|---|
TypeSwitch [constructor] | Move-construct from another TypeSwitch. |
operator= | Assignment operators |
Case | Case overloads |
Default | Default overloads |
DefaultUnreachable | Declare default as unreachable, making sure that all cases were handled. |
operator ResultT | Convert to ResultT, treating a missing case as unreachable. |
| Name | Description |
|---|---|
Unnamed using | Inherit constructors from the CRTP base. |
Case | Inherit Case() overloads from the CRTP base. |
| Name | Description |
|---|---|
castValue | Attempt to dyn_cast the given value to CastT. |
| Name | Description |
|---|---|
value | The root value we are switching on. |
| Name | Description |
|---|---|
TypeSwitch<T, void> | Specialization of TypeSwitch for void returning callables. |