CIRCT  20.0.0git
Public Member Functions | Private Attributes | List of all members
circt::StringAttrOrRef Class Reference

A helper union that can represent a StringAttr, StringRef, or Twine. More...

#include <BuilderUtils.h>

Collaboration diagram for circt::StringAttrOrRef:
Collaboration graph
[legend]

Public Member Functions

 StringAttrOrRef ()
 
 StringAttrOrRef (StringAttr attr)
 
 StringAttrOrRef (const StringRef &str)
 
 StringAttrOrRef (const char *ptr)
 
 StringAttrOrRef (const std::string &str)
 
 StringAttrOrRef (const Twine &twine)
 
StringAttr get (MLIRContext *context) const
 Return the represented string as a StringAttr. More...
 

Private Attributes

std::variant< StringAttr, StringRef, Twine, const char * > value
 

Detailed Description

A helper union that can represent a StringAttr, StringRef, or Twine.

It is intended to be used as arguments to an op's build function. This allows a single builder to accept any flavor value for a string attribute. The get function can then be used to obtain a StringAttr from any of the possible variants StringAttrOrRef can take.

Definition at line 27 of file BuilderUtils.h.

Constructor & Destructor Documentation

◆ StringAttrOrRef() [1/6]

circt::StringAttrOrRef::StringAttrOrRef ( )
inline

Definition at line 31 of file BuilderUtils.h.

◆ StringAttrOrRef() [2/6]

circt::StringAttrOrRef::StringAttrOrRef ( StringAttr  attr)
inline

Definition at line 32 of file BuilderUtils.h.

◆ StringAttrOrRef() [3/6]

circt::StringAttrOrRef::StringAttrOrRef ( const StringRef &  str)
inline

Definition at line 33 of file BuilderUtils.h.

◆ StringAttrOrRef() [4/6]

circt::StringAttrOrRef::StringAttrOrRef ( const char *  ptr)
inline

Definition at line 34 of file BuilderUtils.h.

◆ StringAttrOrRef() [5/6]

circt::StringAttrOrRef::StringAttrOrRef ( const std::string &  str)
inline

Definition at line 35 of file BuilderUtils.h.

◆ StringAttrOrRef() [6/6]

circt::StringAttrOrRef::StringAttrOrRef ( const Twine &  twine)
inline

Definition at line 36 of file BuilderUtils.h.

Member Function Documentation

◆ get()

StringAttr circt::StringAttrOrRef::get ( MLIRContext *  context) const
inline

Return the represented string as a StringAttr.

Definition at line 39 of file BuilderUtils.h.

References circt::calyx::direction::get(), and value.

Member Data Documentation

◆ value

std::variant<StringAttr, StringRef, Twine, const char *> circt::StringAttrOrRef::value
private

Definition at line 28 of file BuilderUtils.h.

Referenced by get(), and Python.support.OpOperand::type().


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