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
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to