@@ -675,65 +675,38 @@ void IntrinsicEmitter::EmitAttributes(const CodeGenIntrinsicTable &Ints,
675
675
unsigned attrIdx = intrinsic.ArgumentAttributes [ai].Index ;
676
676
677
677
OS << " const Attribute::AttrKind AttrParam" << attrIdx << " []= {" ;
678
- bool addComma = false ;
678
+ ListSeparator LS ( " , " ) ;
679
679
680
680
bool AllValuesAreZero = true ;
681
681
SmallVector<uint64_t , 8 > Values;
682
682
do {
683
683
switch (intrinsic.ArgumentAttributes [ai].Kind ) {
684
684
case CodeGenIntrinsic::NoCapture:
685
- if (addComma)
686
- OS << " ," ;
687
- OS << " Attribute::NoCapture" ;
688
- addComma = true ;
685
+ OS << LS << " Attribute::NoCapture" ;
689
686
break ;
690
687
case CodeGenIntrinsic::NoAlias:
691
- if (addComma)
692
- OS << " ," ;
693
- OS << " Attribute::NoAlias" ;
694
- addComma = true ;
688
+ OS << LS << " Attribute::NoAlias" ;
695
689
break ;
696
690
case CodeGenIntrinsic::NoUndef:
697
- if (addComma)
698
- OS << " ," ;
699
- OS << " Attribute::NoUndef" ;
700
- addComma = true ;
691
+ OS << LS << " Attribute::NoUndef" ;
701
692
break ;
702
693
case CodeGenIntrinsic::Returned:
703
- if (addComma)
704
- OS << " ," ;
705
- OS << " Attribute::Returned" ;
706
- addComma = true ;
694
+ OS << LS << " Attribute::Returned" ;
707
695
break ;
708
696
case CodeGenIntrinsic::ReadOnly:
709
- if (addComma)
710
- OS << " ," ;
711
- OS << " Attribute::ReadOnly" ;
712
- addComma = true ;
697
+ OS << LS << " Attribute::ReadOnly" ;
713
698
break ;
714
699
case CodeGenIntrinsic::WriteOnly:
715
- if (addComma)
716
- OS << " ," ;
717
- OS << " Attribute::WriteOnly" ;
718
- addComma = true ;
700
+ OS << LS << " Attribute::WriteOnly" ;
719
701
break ;
720
702
case CodeGenIntrinsic::ReadNone:
721
- if (addComma)
722
- OS << " ," ;
723
- OS << " Attribute::ReadNone" ;
724
- addComma = true ;
703
+ OS << LS << " Attribute::ReadNone" ;
725
704
break ;
726
705
case CodeGenIntrinsic::ImmArg:
727
- if (addComma)
728
- OS << ' ,' ;
729
- OS << " Attribute::ImmArg" ;
730
- addComma = true ;
706
+ OS << LS << " Attribute::ImmArg" ;
731
707
break ;
732
708
case CodeGenIntrinsic::Alignment:
733
- if (addComma)
734
- OS << ' ,' ;
735
- OS << " Attribute::Alignment" ;
736
- addComma = true ;
709
+ OS << LS << " Attribute::Alignment" ;
737
710
break ;
738
711
}
739
712
uint64_t V = intrinsic.ArgumentAttributes [ai].Value ;
@@ -747,13 +720,9 @@ void IntrinsicEmitter::EmitAttributes(const CodeGenIntrinsicTable &Ints,
747
720
// Generate attribute value array if not all attribute values are zero.
748
721
if (!AllValuesAreZero) {
749
722
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;
757
726
OS << " };\n " ;
758
727
}
759
728
0 commit comments