[llvm] 0f360ff - [TableGen] Use ListSeparator (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 9 22:14:48 PST 2021


Author: Kazu Hirata
Date: 2021-02-09T22:14:27-08:00
New Revision: 0f360fffe764e16553549f3883cf4e9e88db17f4

URL: https://github.com/llvm/llvm-project/commit/0f360fffe764e16553549f3883cf4e9e88db17f4
DIFF: https://github.com/llvm/llvm-project/commit/0f360fffe764e16553549f3883cf4e9e88db17f4.diff

LOG: [TableGen] Use ListSeparator (NFC)

Added: 
    

Modified: 
    llvm/utils/TableGen/InfoByHwMode.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/InfoByHwMode.cpp b/llvm/utils/TableGen/InfoByHwMode.cpp
index 7cd1b0f08132..3d236b828032 100644
--- a/llvm/utils/TableGen/InfoByHwMode.cpp
+++ b/llvm/utils/TableGen/InfoByHwMode.cpp
@@ -91,13 +91,10 @@ void ValueTypeByHwMode::writeToStream(raw_ostream &OS) const {
   llvm::sort(Pairs, deref<std::less<PairType>>());
 
   OS << '{';
-  for (unsigned i = 0, e = Pairs.size(); i != e; ++i) {
-    const PairType *P = Pairs[i];
-    OS << '(' << getModeName(P->first)
-       << ':' << getMVTName(P->second).str() << ')';
-    if (i != e-1)
-      OS << ',';
-  }
+  ListSeparator LS(",");
+  for (const PairType *P : Pairs)
+    OS << LS << '(' << getModeName(P->first) << ':'
+       << getMVTName(P->second).str() << ')';
   OS << '}';
 }
 
@@ -183,12 +180,9 @@ void RegSizeInfoByHwMode::writeToStream(raw_ostream &OS) const {
   llvm::sort(Pairs, deref<std::less<PairType>>());
 
   OS << '{';
-  for (unsigned i = 0, e = Pairs.size(); i != e; ++i) {
-    const PairType *P = Pairs[i];
-    OS << '(' << getModeName(P->first) << ':' << P->second << ')';
-    if (i != e-1)
-      OS << ',';
-  }
+  ListSeparator LS(",");
+  for (const PairType *P : Pairs)
+    OS << LS << '(' << getModeName(P->first) << ':' << P->second << ')';
   OS << '}';
 }
 


        


More information about the llvm-commits mailing list