MLIR  20.0.0git
Public Member Functions | List of all members
mlir::tblgen::MethodSignature Class Reference

This class contains the signature of a C++ method, including the return type. More...

#include "mlir/TableGen/Class.h"

Public Member Functions

template<typename RetTypeT , typename NameT >
 MethodSignature (RetTypeT &&retType, NameT &&name, SmallVector< MethodParameter > &&parameters)
 Create a method signature with a return type, a method name, and a list of parameters. More...
 
template<typename RetTypeT , typename NameT >
 MethodSignature (RetTypeT &&retType, NameT &&name, ArrayRef< MethodParameter > parameters)
 Create a method signature with a return type, a method name, and a list of parameters. More...
 
template<typename RetTypeT , typename NameT , typename... Parameters>
 MethodSignature (RetTypeT &&retType, NameT &&name, Parameters &&...parameters)
 Create a method signature with a return type, a method name, and a variadic list of parameters. More...
 
bool makesRedundant (const MethodSignature &other) const
 Determine whether a method with this signature makes a method with other signature redundant. More...
 
StringRef getName () const
 Get the name of the method. More...
 
StringRef getReturnType () const
 Get the return type of the method. More...
 
unsigned getNumParameters () const
 Get the number of parameters. More...
 
void writeDeclTo (raw_indented_ostream &os) const
 Write the signature as part of a method declaration. More...
 
void writeDefTo (raw_indented_ostream &os, StringRef namePrefix) const
 Write the signature as part of a method definition. More...
 
void writeTemplateParamsTo (raw_indented_ostream &os) const
 Write the template parameters of the signature. More...
 
template<typename ParamT >
void addTemplateParam (ParamT param)
 Add a template parameter. More...
 
template<typename ContainerT >
void addTemplateParams (ContainerT &&container)
 Add a list of template parameters. More...
 

Detailed Description

This class contains the signature of a C++ method, including the return type.

method name, and method parameters.

Definition at line 117 of file Class.h.

Constructor & Destructor Documentation

◆ MethodSignature() [1/3]

template<typename RetTypeT , typename NameT >
mlir::tblgen::MethodSignature::MethodSignature ( RetTypeT &&  retType,
NameT &&  name,
SmallVector< MethodParameter > &&  parameters 
)
inline

Create a method signature with a return type, a method name, and a list of parameters.

Take ownership of the list.

Definition at line 122 of file Class.h.

◆ MethodSignature() [2/3]

template<typename RetTypeT , typename NameT >
mlir::tblgen::MethodSignature::MethodSignature ( RetTypeT &&  retType,
NameT &&  name,
ArrayRef< MethodParameter parameters 
)
inline

Create a method signature with a return type, a method name, and a list of parameters.

Definition at line 130 of file Class.h.

◆ MethodSignature() [3/3]

template<typename RetTypeT , typename NameT , typename... Parameters>
mlir::tblgen::MethodSignature::MethodSignature ( RetTypeT &&  retType,
NameT &&  name,
Parameters &&...  parameters 
)
inline

Create a method signature with a return type, a method name, and a variadic list of parameters.

Definition at line 138 of file Class.h.

Member Function Documentation

◆ addTemplateParam()

template<typename ParamT >
void mlir::tblgen::MethodSignature::addTemplateParam ( ParamT  param)
inline

Add a template parameter.

Definition at line 175 of file Class.h.

References mlir::tblgen::stringify().

Referenced by mlir::tblgen::Method::addTemplateParam(), and mlir::tblgen::Method::addTemplateParams().

◆ addTemplateParams()

template<typename ContainerT >
void mlir::tblgen::MethodSignature::addTemplateParams ( ContainerT &&  container)
inline

Add a list of template parameters.

Definition at line 181 of file Class.h.

◆ getName()

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

Get the name of the method.

Definition at line 154 of file Class.h.

Referenced by mlir::tblgen::Method::getName().

◆ getNumParameters()

unsigned mlir::tblgen::MethodSignature::getNumParameters ( ) const
inline

Get the number of parameters.

Definition at line 160 of file Class.h.

References mlir::tblgen::MethodParameters::getNumParameters().

◆ getReturnType()

StringRef mlir::tblgen::MethodSignature::getReturnType ( ) const
inline

Get the return type of the method.

Definition at line 157 of file Class.h.

Referenced by mlir::tblgen::Method::getReturnType().

◆ makesRedundant()

bool MethodSignature::makesRedundant ( const MethodSignature other) const

Determine whether a method with this signature makes a method with other signature redundant.

This occurs if the signatures have the same name and this signature's parameteres subsume the other's.

A method that makes another method redundant with a different return type can replace the other, the assumption being that the subsuming method provides a more resolved return type, e.g. IntegerAttr vs. Attribute.

Definition at line 78 of file Class.cpp.

References mlir::tblgen::MethodParameters::subsumes().

Referenced by mlir::tblgen::Method::makesRedundant().

◆ writeDeclTo()

void MethodSignature::writeDeclTo ( raw_indented_ostream os) const

Write the signature as part of a method declaration.

Definition at line 83 of file Class.cpp.

References getSpaceAfterType(), and mlir::tblgen::MethodParameters::writeDeclTo().

Referenced by mlir::tblgen::Method::writeDeclTo().

◆ writeDefTo()

void MethodSignature::writeDefTo ( raw_indented_ostream os,
StringRef  namePrefix 
) const

Write the signature as part of a method definition.

namePrefix is to be prepended to the method name (typically namespaces for qualifying the method definition).

Definition at line 89 of file Class.cpp.

References getSpaceAfterType(), and mlir::tblgen::MethodParameters::writeDefTo().

◆ writeTemplateParamsTo()

void MethodSignature::writeTemplateParamsTo ( mlir::raw_indented_ostream os) const

Write the template parameters of the signature.

Definition at line 97 of file Class.cpp.

Referenced by mlir::tblgen::Method::writeDeclTo().


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