My Project
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
mlir::tblgen::FmtContext Class Reference

#include <Format.h>

Public Types

enum  PHKind : char {
  PHKind::None, PHKind::Custom, PHKind::Builder, PHKind::Op,
  PHKind::Self
}
 

Public Member Functions

 FmtContext ()=default
 
FmtContextaddSubst (StringRef placeholder, Twine subst)
 
FmtContextwithBuilder (Twine subst)
 
FmtContextwithOp (Twine subst)
 
FmtContextwithSelf (Twine subst)
 
Optional< StringRef > getSubstFor (PHKind placeholder) const
 
Optional< StringRef > getSubstFor (StringRef placeholder) const
 

Static Public Member Functions

static PHKind getPlaceHolderKind (StringRef str)
 

Detailed Description

Format context containing substitutions for special placeholders.

This context divides special placeholders into two categories: builtin ones and custom ones.

Builtin placeholders are baked into FmtContext and each one of them has a dedicated setter. They can be used in all dialects. Their names follow the convention of $_<name>. The rationale of the leading underscore is to avoid confusion and name collision: op arguments/attributes/results are named as $<name>, and we can potentially support referencing those entities directly in the format template in the future. Custom ones are registered by dialect-specific TableGen backends and use the same unified setter.

Member Enumeration Documentation

◆ PHKind

Enumerator
None 
Custom 
Builder 
Op 
Self 

Constructor & Destructor Documentation

◆ FmtContext()

mlir::tblgen::FmtContext::FmtContext ( )
default

Member Function Documentation

◆ addSubst()

FmtContext & tblgen::FmtContext::addSubst ( StringRef  placeholder,
Twine  subst 
)

◆ getPlaceHolderKind()

FmtContext::PHKind tblgen::FmtContext::getPlaceHolderKind ( StringRef  str)
static

◆ getSubstFor() [1/2]

Optional< StringRef > tblgen::FmtContext::getSubstFor ( FmtContext::PHKind  placeholder) const

◆ getSubstFor() [2/2]

Optional< StringRef > tblgen::FmtContext::getSubstFor ( StringRef  placeholder) const

◆ withBuilder()

FmtContext & tblgen::FmtContext::withBuilder ( Twine  subst)

◆ withOp()

FmtContext & tblgen::FmtContext::withOp ( Twine  subst)

◆ withSelf()

FmtContext & tblgen::FmtContext::withSelf ( Twine  subst)

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