================
@@ -1908,7 +1908,7 @@ void clang::EmitClangDiagDocs(const RecordKeeper 
&Records, raw_ostream &OS) {
   for (const Record *G : DiagGroups) {
     bool IsRemarkGroup = isRemarkGroup(G, DiagsInGroup);
     auto &GroupInfo =
-        DiagsInGroup[std::string(G->getValueAsString("GroupName"))];
----------------
jurahul wrote:

Yeah, we need to document it. I can see from the code that we iterate over the 
map (in emitDiagTable)

```
  for (auto const &[Name, GroupInfo] : DiagsInGroup) {
```

with std::map, this iteration happens in an order sorted by the keys in the 
map. And that is needed so that the tablegen generated code is deterministic. I 
don't think StringMap similar iteration order guarantees. See 
https://llvm.org/docs/ProgrammersManual.html#llvm-adt-stringmap-h

```
StringMap iteration order, however, is not guaranteed to be deterministic, so 
any uses which require that should instead use a std::map.
```


https://github.com/llvm/llvm-project/pull/119197
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to