[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:25:39 PST 2024


================
@@ -185,10 +174,8 @@ static void groupDiagnostics(ArrayRef<const Record *> Diags,
   }
 
   // Assign unique ID numbers to the groups.
-  unsigned IDNo = 0;
-  for (std::map<std::string, GroupInfo>::iterator
-       I = DiagsInGroup.begin(), E = DiagsInGroup.end(); I != E; ++I, ++IDNo)
-    I->second.IDNo = IDNo;
+  for (auto [IdNo, Iter] : enumerate(DiagsInGroup))
+    Iter.second.IDNo = IdNo;
----------------
erichkeane wrote:

"are the values" doesn't mean "we didn't copy these and gave you a reference".  So I don't think we can conclude my 5 minute look into the types is accurate based on that comment.

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


More information about the cfe-commits mailing list