[llvm] 3e2e630 - [TableGen] Use ListSeparator (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 11 23:32:06 PST 2021
Author: Kazu Hirata
Date: 2021-02-11T23:31:27-08:00
New Revision: 3e2e63060f6fd86d67d6f49446d5e703a0e68c87
URL: https://github.com/llvm/llvm-project/commit/3e2e63060f6fd86d67d6f49446d5e703a0e68c87
DIFF: https://github.com/llvm/llvm-project/commit/3e2e63060f6fd86d67d6f49446d5e703a0e68c87.diff
LOG: [TableGen] Use ListSeparator (NFC)
Added:
Modified:
llvm/utils/TableGen/CodeGenDAGPatterns.cpp
Removed:
################################################################################
diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
index 0bfb695e8fc5..c9169bf1bbd3 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/llvm/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<SmallVector<TreePatternNode*,1> > *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 << ": ";
More information about the llvm-commits
mailing list