Skip to content

Commit 3289759

Browse files
[TableGen] Use ListSeparator (NFC)
1 parent b3ec6a6 commit 3289759

File tree

1 file changed

+13
-44
lines changed

1 file changed

+13
-44
lines changed

llvm/utils/TableGen/IntrinsicEmitter.cpp

Lines changed: 13 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -675,65 +675,38 @@ void IntrinsicEmitter::EmitAttributes(const CodeGenIntrinsicTable &Ints,
675675
unsigned attrIdx = intrinsic.ArgumentAttributes[ai].Index;
676676

677677
OS << " const Attribute::AttrKind AttrParam" << attrIdx << "[]= {";
678-
bool addComma = false;
678+
ListSeparator LS(",");
679679

680680
bool AllValuesAreZero = true;
681681
SmallVector<uint64_t, 8> Values;
682682
do {
683683
switch (intrinsic.ArgumentAttributes[ai].Kind) {
684684
case CodeGenIntrinsic::NoCapture:
685-
if (addComma)
686-
OS << ",";
687-
OS << "Attribute::NoCapture";
688-
addComma = true;
685+
OS << LS << "Attribute::NoCapture";
689686
break;
690687
case CodeGenIntrinsic::NoAlias:
691-
if (addComma)
692-
OS << ",";
693-
OS << "Attribute::NoAlias";
694-
addComma = true;
688+
OS << LS << "Attribute::NoAlias";
695689
break;
696690
case CodeGenIntrinsic::NoUndef:
697-
if (addComma)
698-
OS << ",";
699-
OS << "Attribute::NoUndef";
700-
addComma = true;
691+
OS << LS << "Attribute::NoUndef";
701692
break;
702693
case CodeGenIntrinsic::Returned:
703-
if (addComma)
704-
OS << ",";
705-
OS << "Attribute::Returned";
706-
addComma = true;
694+
OS << LS << "Attribute::Returned";
707695
break;
708696
case CodeGenIntrinsic::ReadOnly:
709-
if (addComma)
710-
OS << ",";
711-
OS << "Attribute::ReadOnly";
712-
addComma = true;
697+
OS << LS << "Attribute::ReadOnly";
713698
break;
714699
case CodeGenIntrinsic::WriteOnly:
715-
if (addComma)
716-
OS << ",";
717-
OS << "Attribute::WriteOnly";
718-
addComma = true;
700+
OS << LS << "Attribute::WriteOnly";
719701
break;
720702
case CodeGenIntrinsic::ReadNone:
721-
if (addComma)
722-
OS << ",";
723-
OS << "Attribute::ReadNone";
724-
addComma = true;
703+
OS << LS << "Attribute::ReadNone";
725704
break;
726705
case CodeGenIntrinsic::ImmArg:
727-
if (addComma)
728-
OS << ',';
729-
OS << "Attribute::ImmArg";
730-
addComma = true;
706+
OS << LS << "Attribute::ImmArg";
731707
break;
732708
case CodeGenIntrinsic::Alignment:
733-
if (addComma)
734-
OS << ',';
735-
OS << "Attribute::Alignment";
736-
addComma = true;
709+
OS << LS << "Attribute::Alignment";
737710
break;
738711
}
739712
uint64_t V = intrinsic.ArgumentAttributes[ai].Value;
@@ -747,13 +720,9 @@ void IntrinsicEmitter::EmitAttributes(const CodeGenIntrinsicTable &Ints,
747720
// Generate attribute value array if not all attribute values are zero.
748721
if (!AllValuesAreZero) {
749722
OS << " const uint64_t AttrValParam" << attrIdx << "[]= {";
750-
addComma = false;
751-
for (const auto V : Values) {
752-
if (addComma)
753-
OS << ',';
754-
OS << V;
755-
addComma = true;
756-
}
723+
ListSeparator LSV(",");
724+
for (const auto V : Values)
725+
OS << LSV << V;
757726
OS << "};\n";
758727
}
759728

0 commit comments

Comments
 (0)