================
@@ -286,9 +287,14 @@ static void DumpEnumerators(StreamString &strm, size_t 
indent,
 }
 
 std::string RegisterFlags::DumpEnums(uint32_t max_width) const {
-  StreamString strm;
-  bool printed_enumerators_once = false;
-
+  struct TypeToFields {
+    const FieldEnum *enum_type;
+    std::string field_names;
+  };
+  std::vector<TypeToFields> enum_types;
----------------
felipepiovezan wrote:

I would personally have used a `MapVector<FieldEnum *, 
std::vector<std::string>>` to collapse most of the code to:

```
for (const auto &field : m_fields) {
   ....
   enum_types[entry.enum_type].push_back(field.GetType));
}

....
for (auto [enum_type, fields] : enum_types) {
...
  std::string name_string;
 
  llvm::interleave_comma(llvm::raw_string_ostream(name_string), fields);
  name_string += ": "
...
}

https://github.com/llvm/llvm-project/pull/204818
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to