mib added inline comments.

================
Comment at: lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp:321-342
+  auto sort_keys = [&sorted_threads,
+                    &thread_info_sp](StructuredData::Object *item) -> bool {
+    if (!item)
+      return false;
+
+    llvm::StringRef key = item->GetStringValue();
+    size_t idx = 0;
----------------
JDevlieghere wrote:
> Instead of this callback, can we simplify the code by iterating over the keys 
> and populate the map that way?
We don't have iterators to iterate over `StructuredData` containers with a 
range-based loop, so we can only iterate over them using indices ...

I find it ungracious to do it that way because we have to call 
`GetItemAtIndex(idx)` to get the `StructuredData::Object` element from the 
array, that's why I used the `ForEach` method instead.

I think we can improve StructuredData containers to be more customizable and 
operate better with the `std`/`adl` utilities, it should be done separately.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122429/new/

https://reviews.llvm.org/D122429

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to