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

Chelsea Cassanova via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 5 12:41:03 PST 2023


================
@@ -398,13 +398,16 @@ ValueObject::GetChildAtIndexPath(llvm::ArrayRef<size_t> idxs,
   if (idxs.size() == 0)
     return GetSP();
   ValueObjectSP root(GetSP());
+
+  size_t current_index = 0;
   for (size_t idx : idxs) {
     root = root->GetChildAtIndex(idx);
     if (!root) {
       if (index_of_error)
-        *index_of_error = idx;
+        *index_of_error = current_index;
       return root;
     }
+    current_index += 1;
----------------
chelcassanova wrote:

After reading the Swift rationale for removing the `++` operator I understand why you'd use `+= 1` instead.

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


More information about the lldb-commits mailing list