MLIR 22.0.0git
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
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.
 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.
 Method (Method &&)=default
Methodoperator= (Method &&)=default
MethodBodybody ()
 Get the method body.
void setDeprecated (std::optional< StringRef > message)
 Sets or removes the deprecation message of the method.
bool isStatic () const
 Returns true if this is a static method.
bool isPrivate () const
 Returns true if this is a private method.
bool isInline () const
 Returns true if this is an inline method.
bool isConstructor () const
 Returns true if this is a constructor.
bool isConst () const
 Returns true if this class method is const.
StringRef getName () const
 Returns the name of this method.
StringRef getReturnType () const
 Returns the return type of this method.
bool makesRedundant (const Method &other) const
 Returns if this method makes the other method redundant.
void writeDeclTo (raw_indented_ostream &os) const override
 Write the method declaration, including the definition if inline.
void writeDefTo (raw_indented_ostream &os, StringRef namePrefix) const override
 Write the method definition. This is a no-op for inline methods.
template<typename ParamT>
void addTemplateParam (ParamT param)
 Add a template parameter.
template<typename ContainerT>
void addTemplateParams (ContainerT &&container)
 Add a list of template parameters.
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.
Kind getKind () const
 Get the class declaration kind.

Static Protected Member Functions

static bool methodPropertiesAreCompatible (Properties properties)
 Utility method to verify method properties correctness.

Protected Attributes

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

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 310 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 314 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 334 of file Class.h.

References Declaration, methodBody, methodPropertiesAreCompatible(), methodSignature, and properties.

Referenced by mlir::tblgen::Constructor::Constructor(), makesRedundant(), Method(), and operator=().

◆ 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 347 of file Class.h.

References Declaration, methodBody, methodPropertiesAreCompatible(), methodSignature, and properties.

◆ Method() [3/3]

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

References Method().

Member Function Documentation

◆ addTemplateParam()

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

Add a template parameter.

Definition at line 507 of file Class.h.

References Inline, methodSignature, and properties.

◆ addTemplateParams()

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

Add a list of template parameters.

Definition at line 514 of file Class.h.

References Inline, methodSignature, and properties.

◆ body()

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

Get the method body.

Definition at line 362 of file Class.h.

References methodBody.

◆ getName()

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

Returns the name of this method.

Definition at line 385 of file Class.h.

References methodSignature.

◆ getReturnType()

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

Returns the return type of this method.

Definition at line 388 of file Class.h.

References methodSignature.

◆ isConst()

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

Returns true if this class method is const.

Definition at line 382 of file Class.h.

References Const, and properties.

Referenced by methodPropertiesAreCompatible(), writeDeclTo(), and writeDefTo().

◆ isConstructor()

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

Returns true if this is a constructor.

Definition at line 379 of file Class.h.

References Constructor, and properties.

Referenced by methodPropertiesAreCompatible().

◆ isInline()

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

Returns true if this is an inline method.

Definition at line 376 of file Class.h.

References Inline, and properties.

Referenced by methodPropertiesAreCompatible(), mlir::tblgen::Constructor::writeDeclTo(), writeDeclTo(), mlir::tblgen::Constructor::writeDefTo(), and writeDefTo().

◆ isPrivate()

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

Returns true if this is a private method.

Definition at line 373 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 370 of file Class.h.

References properties, and Static.

Referenced by methodPropertiesAreCompatible(), and writeDeclTo().

◆ makesRedundant()

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

Returns if this method makes the other method redundant.

Definition at line 391 of file Class.h.

References Method(), and methodSignature.

◆ methodPropertiesAreCompatible()

bool Method::methodPropertiesAreCompatible ( Properties properties)
staticprotected

Utility method to verify method properties correctness.

Definition at line 162 of file Class.cpp.

References Const, ConstexprValue, Constructor, Declaration, Inline, isConst(), isConstructor(), isInline(), isStatic(), properties, and Static.

Referenced by Method(), and Method().

◆ operator=()

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

References Method().

◆ setDeprecated()

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

Sets or removes the deprecation message of the method.

Definition at line 365 of file Class.h.

References deprecationMessage.

◆ writeDeclTo()

void Method::writeDeclTo ( raw_indented_ostream & os) const
overridevirtual

Write the method declaration, including the definition if inline.

Implements mlir::tblgen::ClassDeclaration.

Definition at line 126 of file Class.cpp.

References ConstexprValue, deprecationMessage, isConst(), isInline(), isStatic(), methodBody, methodSignature, and properties.

◆ writeDefTo()

void 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.

Definition at line 149 of file Class.cpp.

References Declaration, isConst(), isInline(), methodBody, methodSignature, and properties.

Member Data Documentation

◆ deprecationMessage

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

Deprecation message if the method is deprecated.

Definition at line 418 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 416 of file Class.h.

Referenced by body(), Method(), Method(), mlir::tblgen::Constructor::writeDeclTo(), writeDeclTo(), mlir::tblgen::Constructor::writeDefTo(), and writeDefTo().

◆ methodSignature

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

◆ properties


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