From 01ea295bd775c6316bff3354477feb4bf839a08a Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Thu, 11 Feb 2021 23:31:27 -0800 Subject: [PATCH] [TableGen] Use ListSeparator (NFC) --- utils/TableGen/CodeGenDAGPatterns.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/utils/TableGen/CodeGenDAGPatterns.cpp b/utils/TableGen/CodeGenDAGPatterns.cpp index 0bfb695e8fc..c9169bf1bbd 100644 --- a/utils/TableGen/CodeGenDAGPatterns.cpp +++ b/utils/TableGen/CodeGenDAGPatterns.cpp @@ -205,11 +205,9 @@ void TypeSetByHwMode::writeToStream(const SetType &S, raw_ostream &OS) { array_pod_sort(Types.begin(), Types.end()); OS << '['; - for (unsigned i = 0, e = Types.size(); i != e; ++i) { - OS << ValueTypeByHwMode::getMVTName(Types[i]); - if (i != e-1) - OS << ' '; - } + ListSeparator LS(" "); + for (const MVT &T : Types) + OS << LS << ValueTypeByHwMode::getMVTName(T); OS << ']'; } @@ -3032,9 +3030,10 @@ InferAllTypes(const StringMap > *InNamedTypes) { void TreePattern::print(raw_ostream &OS) const { OS << getRecord()->getName(); if (!Args.empty()) { - OS << "(" << Args[0]; - for (unsigned i = 1, e = Args.size(); i != e; ++i) - OS << ", " << Args[i]; + OS << "("; + ListSeparator LS; + for (const std::string &Arg : Args) + OS << LS << Arg; OS << ")"; } OS << ": ";