MLIR  16.0.0git
Typedefs | Functions
mlir::detail::pass_options Namespace Reference

Typedefs

template<typename T >
using has_stream_operator_trait = decltype(std::declval< raw_ostream & >()<< std::declval< T >())
 Trait used to detect if a type has a operator<< method. More...
 
template<typename T >
using has_stream_operator = llvm::is_detected< has_stream_operator_trait, T >
 

Functions

LogicalResult parseCommaSeparatedList (llvm::cl::Option &opt, StringRef argName, StringRef optionStr, function_ref< LogicalResult(StringRef)> elementParseFn)
 Parse a string containing a list of comma-delimited elements, invoking the given parser for each sub-element and passing them to the provided element-append functor. More...
 
template<typename ElementParser , typename ElementAppendFn >
LogicalResult parseCommaSeparatedList (llvm::cl::Option &opt, StringRef argName, StringRef optionStr, ElementParser &elementParser, ElementAppendFn &&appendFn)
 
template<typename ParserT >
static void printOptionValue (raw_ostream &os, const bool &value)
 Utility methods for printing option values. More...
 
template<typename ParserT , typename DataT >
static std::enable_if_t< has_stream_operator< DataT >::valueprintOptionValue (raw_ostream &os, const DataT &value)
 
template<typename ParserT , typename DataT >
static std::enable_if_t<!has_stream_operator< DataT >::valueprintOptionValue (raw_ostream &os, const DataT &value)
 

Typedef Documentation

◆ has_stream_operator

template<typename T >
using mlir::detail::pass_options::has_stream_operator = typedef llvm::is_detected<has_stream_operator_trait, T>

Definition at line 57 of file PassOptions.h.

◆ has_stream_operator_trait

template<typename T >
using mlir::detail::pass_options::has_stream_operator_trait = typedef decltype(std::declval<raw_ostream &>() << std::declval<T>())

Trait used to detect if a type has a operator<< method.

Definition at line 55 of file PassOptions.h.

Function Documentation

◆ parseCommaSeparatedList() [1/2]

LogicalResult mlir::detail::pass_options::parseCommaSeparatedList ( llvm::cl::Option &  opt,
StringRef  argName,
StringRef  optionStr,
function_ref< LogicalResult(StringRef)>  elementParseFn 
)

Parse a string containing a list of comma-delimited elements, invoking the given parser for each sub-element and passing them to the provided element-append functor.

Definition at line 149 of file PassRegistry.cpp.

References mlir::failed(), and mlir::failure().

Referenced by mlir::detail::PassOptions::ListOption< DataType, OptionParser >::handleOccurrence(), llvm::cl::detail::VectorParserBase< SmallVector< T, N >, T >::parse(), parseCommaSeparatedList(), mlir::AsmParser::parseCommaSeparatedList(), and mlir::AsmParser::parseTypeList().

◆ parseCommaSeparatedList() [2/2]

template<typename ElementParser , typename ElementAppendFn >
LogicalResult mlir::detail::pass_options::parseCommaSeparatedList ( llvm::cl::Option &  opt,
StringRef  argName,
StringRef  optionStr,
ElementParser &  elementParser,
ElementAppendFn &&  appendFn 
)

Definition at line 38 of file PassOptions.h.

References mlir::failure(), parseCommaSeparatedList(), mlir::success(), and value.

◆ printOptionValue() [1/3]

template<typename ParserT >
static void mlir::detail::pass_options::printOptionValue ( raw_ostream &  os,
const bool &  value 
)
static

Utility methods for printing option values.

Definition at line 61 of file PassOptions.h.

References value.

Referenced by llvm::cl::detail::VectorParserBase< SmallVector< T, N >, T >::print().

◆ printOptionValue() [2/3]

template<typename ParserT , typename DataT >
static std::enable_if_t<has_stream_operator<DataT>::value> mlir::detail::pass_options::printOptionValue ( raw_ostream &  os,
const DataT &  value 
)
static

Definition at line 66 of file PassOptions.h.

References value.

◆ printOptionValue() [3/3]

template<typename ParserT , typename DataT >
static std::enable_if_t<!has_stream_operator<DataT>::value> mlir::detail::pass_options::printOptionValue ( raw_ostream &  os,
const DataT &  value 
)
static

Definition at line 71 of file PassOptions.h.

References print().