Skip to content

Commit d905824

Browse files
author
git apple-llvm automerger
committed
Merge commit 'c1552695aede' from llvm.org/main into next
2 parents 6c728c1 + c155269 commit d905824

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

lldb/include/lldb/Core/ValueObject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,15 +473,15 @@ class ValueObject {
473473
virtual lldb::ValueObjectSP GetChildAtIndex(size_t idx,
474474
bool can_create = true);
475475

476-
// this will always create the children if necessary
476+
// The method always creates missing children in the path, if necessary.
477477
lldb::ValueObjectSP GetChildAtIndexPath(llvm::ArrayRef<size_t> idxs,
478478
size_t *index_of_error = nullptr);
479479

480480
lldb::ValueObjectSP
481481
GetChildAtIndexPath(llvm::ArrayRef<std::pair<size_t, bool>> idxs,
482482
size_t *index_of_error = nullptr);
483483

484-
// this will always create the children if necessary
484+
// The method always creates missing children in the path, if necessary.
485485
lldb::ValueObjectSP GetChildAtNamePath(llvm::ArrayRef<llvm::StringRef> names);
486486

487487
virtual lldb::ValueObjectSP GetChildMemberWithName(llvm::StringRef name,

lldb/source/Core/ValueObject.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,13 +483,16 @@ ValueObject::GetChildAtIndexPath(llvm::ArrayRef<size_t> idxs,
483483
if (idxs.size() == 0)
484484
return GetSP();
485485
ValueObjectSP root(GetSP());
486+
487+
size_t current_index = 0;
486488
for (size_t idx : idxs) {
487489
root = root->GetChildAtIndex(idx);
488490
if (!root) {
489491
if (index_of_error)
490-
*index_of_error = idx;
492+
*index_of_error = current_index;
491493
return root;
492494
}
495+
current_index += 1;
493496
}
494497
return root;
495498
}
@@ -499,13 +502,17 @@ lldb::ValueObjectSP ValueObject::GetChildAtIndexPath(
499502
if (idxs.size() == 0)
500503
return GetSP();
501504
ValueObjectSP root(GetSP());
505+
506+
size_t current_index = 0;
502507
for (std::pair<size_t, bool> idx : idxs) {
503508
root = root->GetChildAtIndex(idx.first, idx.second);
504509
if (!root) {
505510
if (index_of_error)
506-
*index_of_error = idx.first;
511+
*index_of_error = current_index;
507512
return root;
508513
}
514+
515+
current_index += 1;
509516
}
510517
return root;
511518
}

0 commit comments

Comments
 (0)