[all-commits] [llvm/llvm-project] 307cd8: [lldb][NFCI] Remove CommandObjectProcessHandle::Ve...

Alex Langford via All-commits all-commits at lists.llvm.org
Wed Feb 14 10:21:09 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 307cd883546348cd658d74699915fd48ae01e9a0
      https://github.com/llvm/llvm-project/commit/307cd883546348cd658d74699915fd48ae01e9a0
  Author: Alex Langford <alangford at apple.com>
  Date:   2024-02-14 (Wed, 14 Feb 2024)

  Changed paths:
    M lldb/source/Commands/CommandObjectProcess.cpp

  Log Message:
  -----------
  [lldb][NFCI] Remove CommandObjectProcessHandle::VerifyCommandOptionValue (#79901)

I was refactoring something else but ran into this function. It was
somewhat confusing to read through and understand, but it boils down to
two steps:
- First we try `OptionArgParser::ToBoolean`. If that works, then we're
good to go.
- Second, we try `llvm::to_integer` to see if it's an integer. If it
parses to 0 or 1, we're good.
- Failing either of the steps above means we cannot parse it into a
bool.

Instead of having an integer out param and a bool return value, the
interface is better served with an optional<bool> -- Either it parses
into true or false, or you get back nothing (nullopt).




More information about the All-commits mailing list