9#ifndef CIRCT_SUPPORT_BUILDERUTILS_H
10#define CIRCT_SUPPORT_BUILDERUTILS_H
15#include "mlir/IR/BuiltinOps.h"
16#include "mlir/IR/ImplicitLocOpBuilder.h"
17#include "llvm/ADT/StringSet.h"
18#include "llvm/ADT/TypeSwitch.h"
28 std::variant<StringAttr, StringRef, Twine, const char *>
value;
39 StringAttr
get(MLIRContext *context)
const {
40 if (
auto *attr = std::get_if<StringAttr>(&
value))
42 if (
auto *ref = std::get_if<StringRef>(&
value))
43 return StringAttr::get(context, *ref);
44 if (
auto *twine = std::get_if<Twine>(&
value))
45 return StringAttr::get(context, *twine);
46 if (
auto *ptr = std::get_if<const char *>(&
value))
47 return StringAttr::get(context, *ptr);
A helper union that can represent a StringAttr, StringRef, or Twine.
StringAttr get(MLIRContext *context) const
Return the represented string as a StringAttr.
std::variant< StringAttr, StringRef, Twine, const char * > value
StringAttrOrRef(const std::string &str)
StringAttrOrRef(const char *ptr)
StringAttrOrRef(StringAttr attr)
StringAttrOrRef(const StringRef &str)
StringAttrOrRef(const Twine &twine)
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.