15 #include "llvm/ADT/Twine.h"
16 #include "llvm/ADT/TypeSwitch.h"
17 #include "llvm/TableGen/Record.h"
26 return def->isSubClassOf(
"Optional");
30 return def->isSubClassOf(
"Variadic");
34 return def->isSubClassOf(
"VariadicOfVariadic");
39 return def->getValueAsString(
"segmentAttrName");
45 const llvm::Record *baseType =
def;
47 baseType = baseType->getValueAsDef(
"baseType");
50 const llvm::RecordVal *builderCall = baseType->getValue(
"builderCall");
51 if (!builderCall || !builderCall->getValue())
54 builderCall->getValue())
55 .Case<llvm::StringInit>([&](
auto *init) {
56 StringRef value = init->getValue();
57 return value.empty() ? std::optional<StringRef>() : value;
59 .Default([](
auto *) {
return std::nullopt; });
64 StringRef className =
def->getValueAsString(
"cppClassName");
67 if (className.contains(
"::"))
68 return className.str();
71 if (
const llvm::RecordVal *value =
def->getValue(
"dialect")) {
72 Dialect dialect(cast<const llvm::DefInit>(value->getValue())->getDef());
75 return className.str();
StringRef getCppNamespace() const
TypeConstraint(const llvm::DefInit *record)
StringRef getVariadicOfVariadicSegmentSizeAttr() const
bool isVariableLength() const
std::string getCPPClassName() const
std::optional< StringRef > getBuilderCall() const
bool isVariadicOfVariadic() const
Dialect getDialect() const
Type(const llvm::Record *record)
Include the generated interface declarations.