[Lldb-commits] [lldb] [lldb] Return index of element in ValueObject path instead of the element's value (PR #74413)

Felipe de Azevedo Piovezan via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 5 12:42:36 PST 2023


================
@@ -414,13 +417,17 @@ lldb::ValueObjectSP ValueObject::GetChildAtIndexPath(
   if (idxs.size() == 0)
     return GetSP();
   ValueObjectSP root(GetSP());
+
+  size_t current_index = 0;
   for (std::pair<size_t, bool> idx : idxs) {
     root = root->GetChildAtIndex(idx.first, idx.second);
     if (!root) {
       if (index_of_error)
-        *index_of_error = idx.first;
+        *index_of_error = current_index;
       return root;
     }
+
+    current_index += 1;
----------------
felipepiovezan wrote:

Note this guideline is about pre vs post, and it refers to iterators mostly.

I don't think you need to change anything here!

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


More information about the lldb-commits mailing list