@@ -17,15 +17,15 @@ namespace {
1717
1818class Attributes {
1919public:
20- Attributes (RecordKeeper &R) : Records(R) {}
20+ Attributes (const RecordKeeper &R) : Records(R) {}
2121 void run (raw_ostream &OS);
2222
2323private:
2424 void emitTargetIndependentNames (raw_ostream &OS);
2525 void emitFnAttrCompatCheck (raw_ostream &OS, bool IsStringAttr);
2626 void emitAttributeProperties (raw_ostream &OF);
2727
28- RecordKeeper &Records;
28+ const RecordKeeper &Records;
2929};
3030
3131} // End anonymous namespace.
@@ -85,10 +85,7 @@ void Attributes::emitFnAttrCompatCheck(raw_ostream &OS, bool IsStringAttr) {
8585 << " const Function &Callee) {\n " ;
8686 OS << " bool Ret = true;\n\n " ;
8787
88- std::vector<Record *> CompatRules =
89- Records.getAllDerivedDefinitions (" CompatRule" );
90-
91- for (auto *Rule : CompatRules) {
88+ for (const Record *Rule : Records.getAllDerivedDefinitions (" CompatRule" )) {
9289 StringRef FuncName = Rule->getValueAsString (" CompatFunc" );
9390 OS << " Ret &= " << FuncName << " (Caller, Callee" ;
9491 StringRef AttrName = Rule->getValueAsString (" AttrName" );
@@ -101,12 +98,10 @@ void Attributes::emitFnAttrCompatCheck(raw_ostream &OS, bool IsStringAttr) {
10198 OS << " return Ret;\n " ;
10299 OS << " }\n\n " ;
103100
104- std::vector<Record *> MergeRules =
105- Records.getAllDerivedDefinitions (" MergeRule" );
106101 OS << " static inline void mergeFnAttrs(Function &Caller,\n "
107102 << " const Function &Callee) {\n " ;
108103
109- for (auto *Rule : MergeRules ) {
104+ for (const Record *Rule : Records. getAllDerivedDefinitions ( " MergeRule " ) ) {
110105 StringRef FuncName = Rule->getValueAsString (" MergeFunc" );
111106 OS << " " << FuncName << " (Caller, Callee);\n " ;
112107 }
0 commit comments