Skip to content

Commit 094fc4d

Browse files
[TableGen] Use ListSeparator (NFC)
1 parent 7a37d98 commit 094fc4d

File tree

1 file changed

+12
-28
lines changed

1 file changed

+12
-28
lines changed

llvm/utils/TableGen/InstrDocsEmitter.cpp

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,9 @@ void EmitInstrDocs(RecordKeeper &RK, raw_ostream &OS) {
141141
FLAG(isAuthenticated)
142142
if (!FlagStrings.empty()) {
143143
OS << "Flags: ";
144-
bool IsFirst = true;
145-
for (auto FlagString : FlagStrings) {
146-
if (!IsFirst)
147-
OS << ", ";
148-
OS << "``" << FlagString << "``";
149-
IsFirst = false;
150-
}
144+
ListSeparator LS;
145+
for (auto FlagString : FlagStrings)
146+
OS << LS << "``" << FlagString << "``";
151147
OS << "\n\n";
152148
}
153149

@@ -192,26 +188,18 @@ void EmitInstrDocs(RecordKeeper &RK, raw_ostream &OS) {
192188
// Implicit definitions.
193189
if (!II->ImplicitDefs.empty()) {
194190
OS << "Implicit defs: ";
195-
bool IsFirst = true;
196-
for (Record *Def : II->ImplicitDefs) {
197-
if (!IsFirst)
198-
OS << ", ";
199-
OS << "``" << Def->getName() << "``";
200-
IsFirst = false;
201-
}
191+
ListSeparator LS;
192+
for (Record *Def : II->ImplicitDefs)
193+
OS << LS << "``" << Def->getName() << "``";
202194
OS << "\n\n";
203195
}
204196

205197
// Implicit uses.
206198
if (!II->ImplicitUses.empty()) {
207199
OS << "Implicit uses: ";
208-
bool IsFirst = true;
209-
for (Record *Use : II->ImplicitUses) {
210-
if (!IsFirst)
211-
OS << ", ";
212-
OS << "``" << Use->getName() << "``";
213-
IsFirst = false;
214-
}
200+
ListSeparator LS;
201+
for (Record *Use : II->ImplicitUses)
202+
OS << LS << "``" << Use->getName() << "``";
215203
OS << "\n\n";
216204
}
217205

@@ -220,13 +208,9 @@ void EmitInstrDocs(RecordKeeper &RK, raw_ostream &OS) {
220208
II->TheDef->getValueAsListOfDefs("Predicates");
221209
if (!Predicates.empty()) {
222210
OS << "Predicates: ";
223-
bool IsFirst = true;
224-
for (Record *P : Predicates) {
225-
if (!IsFirst)
226-
OS << ", ";
227-
OS << "``" << P->getName() << "``";
228-
IsFirst = false;
229-
}
211+
ListSeparator LS;
212+
for (Record *P : Predicates)
213+
OS << LS << "``" << P->getName() << "``";
230214
OS << "\n\n";
231215
}
232216
}

0 commit comments

Comments
 (0)