MLIR 22.0.0git
mlir::tblgen::MethodParameter Class Reference

This class contains a single method parameter for a C++ function. More...

#include "mlir/TableGen/Class.h"

Public Member Functions

template<typename TypeT, typename NameT, typename DefaultT>
 MethodParameter (TypeT &&type, NameT &&name, DefaultT &&defaultValue, bool optional=false)
 Create a method parameter with a C++ type, parameter name, and an optional default value.
template<typename TypeT, typename NameT>
 MethodParameter (TypeT &&type, NameT &&name, bool optional=false)
 Create a method parameter with a C++ type, parameter name, and no default value.
void writeDeclTo (raw_indented_ostream &os) const
 Write the parameter as part of a method declaration.
void writeDefTo (raw_indented_ostream &os) const
 Write the parameter as part of a method definition.
StringRef getType () const
 Get the C++ type.
StringRef getName () const
 Get the C++ parameter name.
bool hasDefaultValue () const
 Returns true if the parameter has a default value.
StringRef getDefaultValue () const
 Get the default value.
bool isOptional () const
 Returns true if the parameter is optional.

Detailed Description

This class contains a single method parameter for a C++ function.

Definition at line 43 of file Class.h.

Constructor & Destructor Documentation

◆ MethodParameter() [1/2]

template<typename TypeT, typename NameT, typename DefaultT>
mlir::tblgen::MethodParameter::MethodParameter ( TypeT && type,
NameT && name,
DefaultT && defaultValue,
bool optional = false )
inline

Create a method parameter with a C++ type, parameter name, and an optional default value.

Marking a parameter as "optional" is a cosmetic effect on the generated code.

Definition at line 49 of file Class.h.

References mlir::tblgen::stringify().

Referenced by MethodParameter().

◆ MethodParameter() [2/2]

template<typename TypeT, typename NameT>
mlir::tblgen::MethodParameter::MethodParameter ( TypeT && type,
NameT && name,
bool optional = false )
inline

Create a method parameter with a C++ type, parameter name, and no default value.

Definition at line 59 of file Class.h.

References MethodParameter().

Member Function Documentation

◆ getDefaultValue()

StringRef mlir::tblgen::MethodParameter::getDefaultValue ( ) const
inline

Get the default value.

Definition at line 75 of file Class.h.

◆ getName()

StringRef mlir::tblgen::MethodParameter::getName ( ) const
inline

Get the C++ parameter name.

Definition at line 71 of file Class.h.

◆ getType()

StringRef mlir::tblgen::MethodParameter::getType ( ) const
inline

Get the C++ type.

Definition at line 69 of file Class.h.

◆ hasDefaultValue()

bool mlir::tblgen::MethodParameter::hasDefaultValue ( ) const
inline

Returns true if the parameter has a default value.

Definition at line 73 of file Class.h.

Referenced by writeDeclTo().

◆ isOptional()

bool mlir::tblgen::MethodParameter::isOptional ( ) const
inline

Returns true if the parameter is optional.

Definition at line 77 of file Class.h.

◆ writeDeclTo()

void MethodParameter::writeDeclTo ( raw_indented_ostream & os) const

Write the parameter as part of a method declaration.

Definition at line 27 of file Class.cpp.

References getSpaceAfterType(), and hasDefaultValue().

◆ writeDefTo()

void MethodParameter::writeDefTo ( raw_indented_ostream & os) const

Write the parameter as part of a method definition.

Definition at line 35 of file Class.cpp.

References getSpaceAfterType().


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