const std::vector<Init *> &TArgs = R.getTemplateArgs();
if (!TArgs.empty()) {
OS << "<";
- for (unsigned i = 0, e = TArgs.size(); i != e; ++i) {
- if (i) OS << ", ";
- const RecordVal *RV = R.getValue(TArgs[i]);
+ bool NeedComma = false;
+ for (const Init *TA : TArgs) {
+ if (NeedComma) OS << ", ";
+ NeedComma = true;
+ const RecordVal *RV = R.getValue(TA);
assert(RV && "Template argument record not found??");
RV->print(OS, false);
}
const std::vector<Record*> &SC = R.getSuperClasses();
if (!SC.empty()) {
OS << "\t//";
- for (unsigned i = 0, e = SC.size(); i != e; ++i)
- OS << " " << SC[i]->getNameInitAsString();
+ for (const Record *Super : SC)
+ OS << " " << Super->getNameInitAsString();
}
OS << "\n";
- const std::vector<RecordVal> &Vals = R.getValues();
- for (unsigned i = 0, e = Vals.size(); i != e; ++i)
- if (Vals[i].getPrefix() && !R.isTemplateArg(Vals[i].getName()))
- OS << Vals[i];
- for (unsigned i = 0, e = Vals.size(); i != e; ++i)
- if (!Vals[i].getPrefix() && !R.isTemplateArg(Vals[i].getName()))
- OS << Vals[i];
+ for (const RecordVal &Val : R.getValues())
+ if (Val.getPrefix() && !R.isTemplateArg(Val.getName()))
+ OS << Val;
+ for (const RecordVal &Val : R.getValues())
+ if (!Val.getPrefix() && !R.isTemplateArg(Val.getName()))
+ OS << Val;
return OS << "}\n";
}