OS << "#ifdef GET_ATTR_ENUM\n";
OS << "#undef GET_ATTR_ENUM\n";
- const std::vector<Record*> &Attrs =
+ std::vector<Record*> Attrs =
Records.getAllDerivedDefinitions("EnumAttr");
for (auto A : Attrs)
<< " const Function &Callee) {\n";
OS << " bool Ret = true;\n\n";
- const std::vector<Record *> &CompatRules =
+ std::vector<Record *> CompatRules =
Records.getAllDerivedDefinitions("CompatRule");
for (auto *Rule : CompatRules) {
OS << " return Ret;\n";
OS << "}\n\n";
- const std::vector<Record *> &MergeRules =
+ std::vector<Record *> MergeRules =
Records.getAllDerivedDefinitions("MergeRule");
OS << "static inline void mergeFnAttrs(Function &Caller,\n"
<< " const Function &Callee) {\n";
OS << "// EnumAttr classes\n";
for (const auto *R : Records) {
OS << "struct " << R->getName() << "Attr : EnumAttr {\n";
- OS << " constexpr static const enum Attribute::AttrKind Kind = ";
- OS << "Attribute::" << R->getName() << ";\n";
+ OS << " static enum Attribute::AttrKind getKind() {\n";
+ OS << " return llvm::Attribute::" << R->getName() << ";\n";
+ OS << " }\n";
OS << "};\n";
}
OS << "\n";
OS << "// StrBoolAttr classes\n";
for (const auto *R : Records) {
OS << "struct " << R->getName() << "Attr : StrBoolAttr {\n";
- OS << " constexpr static const char * const Kind = \"";
- OS << R->getValueAsString("AttrString") << "\";\n";
+ OS << " static const char *getKind() {\n";
+ OS << " return \"" << R->getValueAsString("AttrString") << "\";\n";
+ OS << " }\n";
OS << "};\n";
}
OS << "\n";