aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/DebugInfo/LogicalView/CodeViewReaderTest.cpp
diff options
context:
space:
mode:
authorPete Lawrence <plawrence@apple.com>2023-12-13 13:26:05 -1000
committerGitHub <noreply@github.com>2023-12-13 15:26:05 -0800
commitc1552695aedebe02e1973d489b93af4e64e9d1a8 (patch)
tree9281b4d6ba2f5f641eb72cda405b70f3a509ecb5 /llvm/unittests/DebugInfo/LogicalView/CodeViewReaderTest.cpp
parente52c941921e263aad75a6685caad64d6ab457bee (diff)
downloadllvm-c1552695aedebe02e1973d489b93af4e64e9d1a8.zip
llvm-c1552695aedebe02e1973d489b93af4e64e9d1a8.tar.gz
llvm-c1552695aedebe02e1973d489b93af4e64e9d1a8.tar.bz2
[lldb] Return index of element in ValueObject path instead of the element's value (#74413)
It's more meaningful and actionable to indicate which element in the array has an issue by returning that element's index instead of its value. The value can be ambiguous if at least one other element has the same value. The first parameter for these methods is `idxs`, an array of indices that represent a path from a (root) parent to on of its descendants, typically though intermediate descendants. When the path leads to a descendant that doesn't exist, the method is supposed to indicate where things went wrong by setting an index to `&index_of_error`, the second parameter. The problem is the method sets `*index_of_error` to the index of the most recent parent's child in the hierarchy, which isn't very useful if there's more one index with the same value in the path. In this example, each element in the path has a value that's the same as another element. ```cpp GetChildAtIndexPath({1, 2, 3, 3, 1, 1, 2}, &index_of_error); ``` Say the the second `1` in the path (the 5th element at `[4]`) doesn't exist and the code returns a `nullptr`. In that situation, the code sets `*index_of_error` to `1`, but that's an ambiguous hint can implicate the 1st, 5th, or 6th element (at `[0]`, `[4]`, or `[5]`). It’s more helpful to set `*index_of_error` to `4` to clearly indicate which element in `idxs` has the issue.
Diffstat (limited to 'llvm/unittests/DebugInfo/LogicalView/CodeViewReaderTest.cpp')
0 files changed, 0 insertions, 0 deletions