Skip to content

Commit 87360d6

Browse files
[TableGen] Use ListSeparator (NFC)
1 parent d639120 commit 87360d6

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

llvm/utils/TableGen/FixedLenDecoderEmitter.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,14 +1210,9 @@ bool FilterChooser::emitPredicateMatch(raw_ostream &o, unsigned &Indentation,
12101210
if (IsOr)
12111211
o << "(";
12121212

1213-
bool First = true;
1213+
ListSeparator LS(IsOr ? " || " : " && ");
12141214
for (auto *Arg : D->getArgs()) {
1215-
if (!First) {
1216-
if (IsOr)
1217-
o << " || ";
1218-
else
1219-
o << " && ";
1220-
}
1215+
o << LS;
12211216
if (auto *NotArg = dyn_cast<DagInit>(Arg)) {
12221217
if (NotArg->getOperator()->getAsString() != "not" ||
12231218
NotArg->getNumArgs() != 1)
@@ -1230,8 +1225,6 @@ bool FilterChooser::emitPredicateMatch(raw_ostream &o, unsigned &Indentation,
12301225
PrintFatalError(Pred->getLoc(), "Invalid AssemblerCondDag!");
12311226
o << "Bits[" << Emitter->PredicateNamespace << "::" << Arg->getAsString()
12321227
<< "]";
1233-
1234-
First = false;
12351228
}
12361229

12371230
if (IsOr)

llvm/utils/TableGen/SubtargetFeatureInfo.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,9 @@ void SubtargetFeatureInfo::emitComputeAssemblerAvailableFeatures(
130130
if (IsOr)
131131
OS << "(";
132132

133-
bool First = true;
133+
ListSeparator LS(IsOr ? " || " : " && ");
134134
for (auto *Arg : D->getArgs()) {
135-
if (!First) {
136-
if (IsOr)
137-
OS << " || ";
138-
else
139-
OS << " && ";
140-
}
135+
OS << LS;
141136
if (auto *NotArg = dyn_cast<DagInit>(Arg)) {
142137
if (NotArg->getOperator()->getAsString() != "not" ||
143138
NotArg->getNumArgs() != 1)
@@ -149,8 +144,6 @@ void SubtargetFeatureInfo::emitComputeAssemblerAvailableFeatures(
149144
!cast<DefInit>(Arg)->getDef()->isSubClassOf("SubtargetFeature"))
150145
PrintFatalError(SFI.TheDef->getLoc(), "Invalid AssemblerCondDag!");
151146
OS << "FB[" << TargetName << "::" << Arg->getAsString() << "]";
152-
153-
First = false;
154147
}
155148

156149
if (IsOr)

0 commit comments

Comments
 (0)