MLIR  19.0.0git
Public Types | Public Member Functions | Protected Attributes | List of all members
mlir::tblgen::Method Class Reference

Class for holding an op's method for C++ code emission. More...

#include "mlir/TableGen/Class.h"

+ Inheritance diagram for mlir::tblgen::Method:

Public Types

enum  Properties {
  None = 0x0 , Static = 0x1 , Constructor = 0x2 , Private = 0x4 ,
  Declaration = 0x8 , Inline = 0x10 , ConstexprValue = 0x20 , Const = 0x40 ,
  Constexpr = ConstexprValue | Inline , StaticDeclaration = Static | Declaration , StaticInline = Static | Inline , ConstInline = Const | Inline ,
  ConstDeclaration = Const | Declaration
}
 Properties (qualifiers) of class methods. More...
 
- Public Types inherited from mlir::tblgen::ClassDeclarationBase< ClassDeclaration::Method >
using Base = ClassDeclarationBase< DeclKind >
 
- Public Types inherited from mlir::tblgen::ClassDeclaration
enum  Kind {
  Method , UsingDeclaration , VisibilityDeclaration , Field ,
  ExtraClassDeclaration
}
 Kinds for LLVM-style RTTI. More...
 

Public Member Functions

template<typename RetTypeT , typename NameT , typename... Args>
 Method (RetTypeT &&retType, NameT &&name, Properties properties, Args &&...args)
 Create a method with a return type, a name, method properties, and a some parameters. More...
 
 Method (StringRef retType, StringRef name, Properties properties, std::initializer_list< MethodParameter > params)
 Create a method with a return type, a name, method properties, and a list of parameters. More...
 
 Method (Method &&)=default
 
Methodoperator= (Method &&)=default
 
MethodBodybody ()
 Get the method body. More...
 
void setDeprecated (std::optional< StringRef > message)
 Sets or removes the deprecation message of the method. More...
 
bool isStatic () const
 Returns true if this is a static method. More...
 
bool isPrivate () const
 Returns true if this is a private method. More...
 
bool isInline () const
 Returns true if this is an inline method. More...
 
bool isConstructor () const
 Returns true if this is a constructor. More...
 
bool isConst () const
 Returns true if this class method is const. More...
 
StringRef getName () const
 Returns the name of this method. More...
 
StringRef getReturnType () const
 Returns the return type of this method. More...
 
bool makesRedundant (const Method &other) const
 Returns if this method makes the other method redundant. More...
 
void writeDeclTo (raw_indented_ostream &os) const override
 Write the method declaration, including the definition if inline. More...
 
void writeDefTo (raw_indented_ostream &os, StringRef namePrefix) const override
 Write the method definition. This is a no-op for inline methods. 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...
 
- Public Member Functions inherited from mlir::tblgen::ClassDeclarationBase< ClassDeclaration::Method >
 ClassDeclarationBase ()
 
- Public Member Functions inherited from mlir::tblgen::ClassDeclaration
virtual ~ClassDeclaration ()=default
 
 ClassDeclaration (Kind kind)
 Create a class declaration with a given kind. More...
 
Kind getKind () const
 Get the class declaration kind. More...
 

Protected Attributes

Properties properties
 A collection of method properties. More...
 
MethodSignature methodSignature
 The signature of the method. More...
 
MethodBody methodBody
 The body of the method, if it has one. More...
 
std::optional< std::string > deprecationMessage
 Deprecation message if the method is deprecated. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from mlir::tblgen::ClassDeclarationBase< ClassDeclaration::Method >
static bool classof (const ClassDeclaration *other)
 

Detailed Description

Class for holding an op's method for C++ code emission.

Definition at line 305 of file Class.h.

Member Enumeration Documentation

◆ Properties

Properties (qualifiers) of class methods.

Bitfield is used here to help querying properties.

Enumerator
None 
Static 
Constructor 
Private 
Declaration 
Inline 
ConstexprValue 
Const 
Constexpr 
StaticDeclaration 
StaticInline 
ConstInline 
ConstDeclaration 

Definition at line 309 of file Class.h.

Constructor & Destructor Documentation

◆ Method() [1/3]

template<typename RetTypeT , typename NameT , typename... Args>
mlir::tblgen::Method::Method ( RetTypeT &&  retType,
NameT &&  name,
Properties  properties,
Args &&...  args 
)
inline

Create a method with a return type, a name, method properties, and a some parameters.

The parameteres may be passed as a list or as a variadic pack.

Definition at line 329 of file Class.h.

◆ Method() [2/3]

mlir::tblgen::Method::Method ( StringRef  retType,
StringRef  name,
Properties  properties,
std::initializer_list< MethodParameter params 
)
inline

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

Definition at line 337 of file Class.h.

◆ Method() [3/3]

mlir::tblgen::Method::Method ( Method &&  )
default

Member Function Documentation

◆ addTemplateParam()

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

Add a template parameter.

Definition at line 488 of file Class.h.

References mlir::tblgen::MethodSignature::addTemplateParam(), Inline, methodSignature, and properties.

◆ addTemplateParams()

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

Add a list of template parameters.

Definition at line 495 of file Class.h.

References mlir::tblgen::MethodSignature::addTemplateParam(), Inline, methodSignature, and properties.

◆ body()

MethodBody& mlir::tblgen::Method::body ( )
inline

Get the method body.

Definition at line 347 of file Class.h.

References methodBody.

◆ getName()

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

Returns the name of this method.

Definition at line 370 of file Class.h.

References mlir::tblgen::MethodSignature::getName(), and methodSignature.

◆ getReturnType()

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

Returns the return type of this method.

Definition at line 373 of file Class.h.

References mlir::tblgen::MethodSignature::getReturnType(), and methodSignature.

◆ isConst()

bool mlir::tblgen::Method::isConst ( ) const
inline

Returns true if this class method is const.

Definition at line 367 of file Class.h.

References Const, and properties.

Referenced by writeDeclTo().

◆ isConstructor()

bool mlir::tblgen::Method::isConstructor ( ) const
inline

Returns true if this is a constructor.

Definition at line 364 of file Class.h.

References Constructor, and properties.

◆ isInline()

bool mlir::tblgen::Method::isInline ( ) const
inline

Returns true if this is an inline method.

Definition at line 361 of file Class.h.

References Inline, and properties.

Referenced by writeDeclTo().

◆ isPrivate()

bool mlir::tblgen::Method::isPrivate ( ) const
inline

Returns true if this is a private method.

Definition at line 358 of file Class.h.

References Private, and properties.

◆ isStatic()

bool mlir::tblgen::Method::isStatic ( ) const
inline

Returns true if this is a static method.

Definition at line 355 of file Class.h.

References properties, and Static.

Referenced by writeDeclTo().

◆ makesRedundant()

bool mlir::tblgen::Method::makesRedundant ( const Method other) const
inline

Returns if this method makes the other method redundant.

Definition at line 376 of file Class.h.

References mlir::tblgen::MethodSignature::makesRedundant(), and methodSignature.

◆ operator=()

Method& mlir::tblgen::Method::operator= ( Method &&  )
default

◆ setDeprecated()

void mlir::tblgen::Method::setDeprecated ( std::optional< StringRef >  message)
inline

Sets or removes the deprecation message of the method.

Definition at line 350 of file Class.h.

References deprecationMessage.

◆ writeDeclTo()

void Method::writeDeclTo ( raw_indented_ostream os) const
overridevirtual

◆ writeDefTo()

void mlir::tblgen::Method::writeDefTo ( raw_indented_ostream os,
StringRef  namePrefix 
) const
overridevirtual

Write the method definition. This is a no-op for inline methods.

Reimplemented from mlir::tblgen::ClassDeclaration.

Reimplemented in mlir::tblgen::Constructor.

Member Data Documentation

◆ deprecationMessage

std::optional<std::string> mlir::tblgen::Method::deprecationMessage
protected

Deprecation message if the method is deprecated.

Definition at line 403 of file Class.h.

Referenced by setDeprecated(), and writeDeclTo().

◆ methodBody

MethodBody mlir::tblgen::Method::methodBody
protected

The body of the method, if it has one.

Definition at line 401 of file Class.h.

Referenced by body(), and writeDeclTo().

◆ methodSignature

MethodSignature mlir::tblgen::Method::methodSignature
protected

The signature of the method.

Definition at line 399 of file Class.h.

Referenced by addTemplateParam(), addTemplateParams(), getName(), getReturnType(), makesRedundant(), and writeDeclTo().

◆ properties

Properties mlir::tblgen::Method::properties
protected

A collection of method properties.

Definition at line 397 of file Class.h.

Referenced by addTemplateParam(), addTemplateParams(), isConst(), isConstructor(), isInline(), isPrivate(), isStatic(), and writeDeclTo().


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