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

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 12 07:29:57 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] :
----------------
erichkeane wrote:

Why are you doing a reference structured binding?  The std::tuple object has two references in it, so the `&` doesn't seem particularly useful as far as I can tell.

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


More information about the cfe-commits mailing list