CIRCT 24.0.0git
Loading...
Searching...
No Matches
circt::firrtl::FIRRTLTypeSwitch< T, ResultT > Class Template Reference

This class implements the same functionality as TypeSwitch except that it uses firrtl::type_dyn_cast for dynamic cast. More...

#include <FIRRTLTypes.h>

Inheritance diagram for circt::firrtl::FIRRTLTypeSwitch< T, ResultT >:
Collaboration diagram for circt::firrtl::FIRRTLTypeSwitch< T, ResultT >:

Public Types

using BaseT = llvm::detail::TypeSwitchBase<FIRRTLTypeSwitch<T, ResultT>, T>

Public Member Functions

 FIRRTLTypeSwitch (FIRRTLTypeSwitch &&other)=default
template<typename CaseT, typename CallableT>
FIRRTLTypeSwitch< T, ResultT > & Case (CallableT &&caseFn)
 Add a case on the given type.
template<typename CallableT>
ResultT Default (CallableT &&defaultFn)
 As a default, invoke the given callable within the root value.
ResultT Default (ResultT defaultResult)
 As a default, return the given value.
 operator ResultT ()

Private Attributes

std::optional< ResultT > result
 The pointer to the result of this switch statement, once known, null before that.

Detailed Description

template<typename T, typename ResultT = void>
class circt::firrtl::FIRRTLTypeSwitch< T, ResultT >

This class implements the same functionality as TypeSwitch except that it uses firrtl::type_dyn_cast for dynamic cast.

llvm::TypeSwitch is not customizable so this class currently duplicates the code.

Definition at line 521 of file FIRRTLTypes.h.

Member Typedef Documentation

◆ BaseT

template<typename T, typename ResultT = void>
using circt::firrtl::FIRRTLTypeSwitch< T, ResultT >::BaseT = llvm::detail::TypeSwitchBase<FIRRTLTypeSwitch<T, ResultT>, T>

Definition at line 524 of file FIRRTLTypes.h.

Constructor & Destructor Documentation

◆ FIRRTLTypeSwitch()

template<typename T, typename ResultT = void>
circt::firrtl::FIRRTLTypeSwitch< T, ResultT >::FIRRTLTypeSwitch ( FIRRTLTypeSwitch< T, ResultT > && other)
default

References FIRRTLTypeSwitch().

Referenced by FIRRTLTypeSwitch().

Member Function Documentation

◆ Case()

◆ Default() [1/2]

template<typename T, typename ResultT = void>
template<typename CallableT>
ResultT circt::firrtl::FIRRTLTypeSwitch< T, ResultT >::Default ( CallableT && defaultFn)
inlinenodiscard

As a default, invoke the given callable within the root value.

Definition at line 545 of file FIRRTLTypes.h.

References result.

◆ Default() [2/2]

template<typename T, typename ResultT = void>
ResultT circt::firrtl::FIRRTLTypeSwitch< T, ResultT >::Default ( ResultT defaultResult)
inlinenodiscard

As a default, return the given value.

Definition at line 553 of file FIRRTLTypes.h.

References result.

◆ operator ResultT()

template<typename T, typename ResultT = void>
circt::firrtl::FIRRTLTypeSwitch< T, ResultT >::operator ResultT ( )
inlinenodiscard

Definition at line 559 of file FIRRTLTypes.h.

References assert(), and result.

Member Data Documentation

◆ result

template<typename T, typename ResultT = void>
std::optional<ResultT> circt::firrtl::FIRRTLTypeSwitch< T, ResultT >::result
private

The pointer to the result of this switch statement, once known, null before that.

Definition at line 567 of file FIRRTLTypes.h.

Referenced by Case(), Default(), Default(), and operator ResultT().


The documentation for this class was generated from the following file: