|
MLIR 24.0.0git
|
This class represents a StringSwitch like class that is useful for parsing expected keywords. More...
#include "mlir/IR/OpImplementation.h"
Public Member Functions | |
| KeywordSwitch (AsmParser &parser, StringRef *keyword=nullptr) | |
| KeywordSwitch & | Case (StringLiteral str, ResultT value) |
| Case that uses the provided value when true. | |
| KeywordSwitch & | Default (ResultT value) |
| template<typename FnT, typename = std::enable_if_t< !std::is_convertible<FnT, ResultT>::value>> | |
| KeywordSwitch & | Case (StringLiteral str, FnT &&fn) |
| Case that invokes the provided functor when true. | |
| template<typename FnT, typename = std::enable_if_t< !std::is_convertible<FnT, ResultT>::value>> | |
| KeywordSwitch & | Default (FnT &&fn) |
| bool | hasValue () const |
| Returns true if this switch has a value yet. | |
| operator ResultT () | |
| Return the result of the switch. | |
This class represents a StringSwitch like class that is useful for parsing expected keywords.
On construction, unless a non-empty keyword is provided, it invokes parseKeyword and processes each of the provided cases statements until a match is hit. The provided ResultT must be assignable from failure().
Definition at line 933 of file OpImplementation.h.
|
inline |
Definition at line 935 of file OpImplementation.h.
References mlir::AsmParser::AsmParser(), mlir::AsmParser::getCurrentLocation(), if(), and this.
|
inline |
Case that invokes the provided functor when true.
The parameters passed to the functor are the keyword, and the location of the keyword (in case any errors need to be emitted).
Definition at line 954 of file OpImplementation.h.
References KeywordSwitch().
|
inline |
Case that uses the provided value when true.
Definition at line 943 of file OpImplementation.h.
References Case(), and KeywordSwitch().
Referenced by Case().
|
inline |
Definition at line 967 of file OpImplementation.h.
References KeywordSwitch().
|
inline |
Definition at line 946 of file OpImplementation.h.
References Default(), and KeywordSwitch().
Referenced by Default().
|
inline |
Returns true if this switch has a value yet.
Definition at line 974 of file OpImplementation.h.
|
inlinenodiscard |
Return the result of the switch.
Definition at line 977 of file OpImplementation.h.