[Lldb-commits] [lldb] [lldb] Upgrade ExtractIndexFromString to use llvm::Expected (PR #138297)

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Fri May 2 12:36:23 PDT 2025


https://github.com/bulbazord commented:

I like the idea of this PR (big fan of `llvm::Expected`) but the way this is implemented contains an anti-pattern IMO. Specifically, all callers consume the error from `ExtractIndexFromString` only to then create a similar but different error string afterwards. It would be great if the callers could just propagate the error from `ExtractIndexFromString` instead of doing this dance.

Perhaps `ExtractIndexFromString` could return the error string `Type has no child named '%s'` and the function could be named something more descriptive? Something like `ExtractIndexOfChildFromString`?

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


More information about the lldb-commits mailing list