CIRCT  18.0.0git
Public Member Functions | Private Types | 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 Twine &twine)
 
StringAttr get (MLIRContext *context) const
 Return the represented string as a StringAttr. More...
 

Private Types

using Value = llvm::PointerUnion< StringAttr, StringRef *, Twine * >
 

Private Attributes

Value 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 22 of file BuilderUtils.h.

Member Typedef Documentation

◆ Value

using circt::StringAttrOrRef::Value = llvm::PointerUnion<StringAttr, StringRef *, Twine *>
private

Definition at line 23 of file BuilderUtils.h.

Constructor & Destructor Documentation

◆ StringAttrOrRef() [1/4]

circt::StringAttrOrRef::StringAttrOrRef ( )
inline

Definition at line 27 of file BuilderUtils.h.

◆ StringAttrOrRef() [2/4]

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

Definition at line 28 of file BuilderUtils.h.

◆ StringAttrOrRef() [3/4]

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

Definition at line 29 of file BuilderUtils.h.

◆ StringAttrOrRef() [4/4]

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

Definition at line 31 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 34 of file BuilderUtils.h.

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

Member Data Documentation

◆ value

Value circt::StringAttrOrRef::value
private

Definition at line 24 of file BuilderUtils.h.

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


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