================ @@ -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; ---------------- jurahul wrote:
Right, this updates the original and not the copy. See the comment at the top of enumerate() which says the same: https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/ADT/STLExtras.h#L2411 ``` /// Given two or more input ranges, returns a new range whose values are /// tuples (A, B, C, ...), such that A is the 0-based index of the item in the /// sequence, and B, C, ..., are the values from the original input ranges. All /// input ranges are required to have equal lengths. Note that the returned /// iterator allows for the values (B, C, ...) to be modified. ``` https://github.com/llvm/llvm-project/pull/115573 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits