[Lldb-commits] [lldb] Report back errors in GetNumChildren() (PR #84265)

via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 7 09:47:21 PST 2024


jimingham wrote:

>From looking at the code, it seems like there are two clear classes of users, those that need to check the error, and those that, in the error case, 0 is just as good as the error.  The latter appears not infrequently as:

`llvm::expectedToStdOptional(value_sp->GetNumChildren(max)).value_or(0)`

which is a bit ugly, but also by embedding this everywhere inline it isn't easy to see who is checking errors and who doesn't need to.

Might be useful to have a GetNumChildrenUnchecked that returns 0 for the error, and use that in place of sprinkling this construct about.

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


More information about the lldb-commits mailing list