[clang] [NFC][Clang] Use range for loops in ClangDiagnosticsEmitter (PR #115573)

Rahul Joshi via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 12 07:28:15 PST 2024


================
@@ -970,10 +942,11 @@ struct DiagTextPrinter : DiagTextVisitor<DiagTextPrinter> {
   void VisitPlural(PluralPiece *P) {
     Result += "%plural{";
     assert(P->Options.size() == P->OptionPrefixes.size());
-    for (unsigned I = 0, End = P->Options.size(); I < End; ++I) {
-      if (P->OptionPrefixes[I])
-        Visit(P->OptionPrefixes[I]);
-      Visit(P->Options[I]);
+    for (const auto &[Prefix, Option] :
----------------
jurahul wrote:

WDYM by valuable? It's value is writing less code to index into different arrays or spelling out .first/.second below.

https://github.com/llvm/llvm-project/pull/115573


More information about the cfe-commits mailing list