diff --git a/utils/TableGen/InstrDocsEmitter.cpp b/utils/TableGen/InstrDocsEmitter.cpp index 66744bf9ece..bc391227edd 100644 --- a/utils/TableGen/InstrDocsEmitter.cpp +++ b/utils/TableGen/InstrDocsEmitter.cpp @@ -141,13 +141,9 @@ void EmitInstrDocs(RecordKeeper &RK, raw_ostream &OS) { FLAG(isAuthenticated) if (!FlagStrings.empty()) { OS << "Flags: "; - bool IsFirst = true; - for (auto FlagString : FlagStrings) { - if (!IsFirst) - OS << ", "; - OS << "``" << FlagString << "``"; - IsFirst = false; - } + ListSeparator LS; + for (auto FlagString : FlagStrings) + OS << LS << "``" << FlagString << "``"; OS << "\n\n"; } @@ -192,26 +188,18 @@ void EmitInstrDocs(RecordKeeper &RK, raw_ostream &OS) { // Implicit definitions. if (!II->ImplicitDefs.empty()) { OS << "Implicit defs: "; - bool IsFirst = true; - for (Record *Def : II->ImplicitDefs) { - if (!IsFirst) - OS << ", "; - OS << "``" << Def->getName() << "``"; - IsFirst = false; - } + ListSeparator LS; + for (Record *Def : II->ImplicitDefs) + OS << LS << "``" << Def->getName() << "``"; OS << "\n\n"; } // Implicit uses. if (!II->ImplicitUses.empty()) { OS << "Implicit uses: "; - bool IsFirst = true; - for (Record *Use : II->ImplicitUses) { - if (!IsFirst) - OS << ", "; - OS << "``" << Use->getName() << "``"; - IsFirst = false; - } + ListSeparator LS; + for (Record *Use : II->ImplicitUses) + OS << LS << "``" << Use->getName() << "``"; OS << "\n\n"; } @@ -220,13 +208,9 @@ void EmitInstrDocs(RecordKeeper &RK, raw_ostream &OS) { II->TheDef->getValueAsListOfDefs("Predicates"); if (!Predicates.empty()) { OS << "Predicates: "; - bool IsFirst = true; - for (Record *P : Predicates) { - if (!IsFirst) - OS << ", "; - OS << "``" << P->getName() << "``"; - IsFirst = false; - } + ListSeparator LS; + for (Record *P : Predicates) + OS << LS << "``" << P->getName() << "``"; OS << "\n\n"; } }