16 #include "llvm/ADT/StringExtras.h"
17 #include "llvm/Support/FormatVariadic.h"
18 #include "llvm/TableGen/Error.h"
19 #include "llvm/TableGen/Record.h"
29 auto *
def = cast<llvm::DefInit>(init)->getDef();
30 if (
def->isSubClassOf(
"PredTrait"))
32 if (
def->isSubClassOf(
"GenInternalTrait"))
34 if (
def->isSubClassOf(
"InterfaceTrait"))
36 assert(
def->isSubClassOf(
"NativeTrait"));
47 llvm::StringRef trait =
def->getValueAsString(
"trait");
48 llvm::StringRef cppNamespace =
def->getValueAsString(
"cppNamespace");
49 return cppNamespace.empty() ? trait.str()
50 : (cppNamespace +
"::" + trait).str();
54 return def->isSubClassOf(
"StructuralOpTrait");
58 return def->getValueAsString(
"extraConcreteClassDeclaration");
62 return def->getValueAsString(
"extraConcreteClassDefinition");
70 return def->getValueAsString(
"trait");
78 auto pred =
Pred(
def->getValueInit(
"predicate"));
79 return pred.getCondition();
83 return def->getValueAsString(
"summary");
93 llvm::StringRef trait =
def->getValueAsString(
"trait");
94 llvm::StringRef cppNamespace =
def->getValueAsString(
"cppNamespace");
95 return cppNamespace.empty() ? trait.str()
96 : (cppNamespace +
"::" + trait).str();
100 return def->isSubClassOf(
"DeclareInterfaceMethods");
104 return def->getValueAsListOfStrings(
"alwaysOverriddenMethods");
std::vector< StringRef > getAlwaysDeclaredMethods() const
std::string getFullyQualifiedTraitName() const
Interface getInterface() const
bool shouldDeclareMethods() const
StringRef getFullyQualifiedTraitName() const
bool isStructuralOpTrait() const
std::string getFullyQualifiedTraitName() const
StringRef getExtraConcreteClassDeclaration() const
StringRef getExtraConcreteClassDefinition() const
StringRef getSummary() const
std::string getPredTemplate() const
Trait(Kind kind, const llvm::Record *def)
static Trait create(const llvm::Init *init)
Include the generated interface declarations.