[Lldb-commits] [lldb] [lldb][NFCI] Minor refactor to CommandObjectProcessHandle::VerifyCommandOptionValue (PR #79901)

via lldb-commits lldb-commits at lists.llvm.org
Mon Jan 29 16:55:58 PST 2024


jimingham wrote:

Looks like I wasn't the one that added this, so I don't feel so bad I can't remember why I did it this way...

I think this VerifyCommandOptionValue is just a historical artifact, we should remove it and do what all the other boolean options do.

Jim


> On Jan 29, 2024, at 4:50 PM, Greg Clayton ***@***.***> wrote:
> 
> 
> @clayborg requested changes on this pull request.
> 
> We should be modify OptionArgParser::ToBoolean(...) to return a std::optional<bool> instead of a local function. It already handles integer strings "0" and "1" correctly. Granted it doesn't allow "00" or "01" to be specified, but I am not sure we care. If we do, we can fix OptionArgParser::ToBoolean(...)
> 
> In lldb/source/Commands/CommandObjectProcess.cpp <https://github.com/llvm/llvm-project/pull/79901#discussion_r1470426698>:
> 
> > @@ -1591,24 +1591,24 @@ class CommandObjectProcessHandle : public CommandObjectParsed {
>  
>    Options *GetOptions() override { return &m_options; }
>  
> -  bool VerifyCommandOptionValue(const std::string &option, int &real_value) {
> -    bool okay = true;
> +  std::optional<bool> VerifyCommandOptionValue(const std::string &option) {
> We should modify OptionArgParser::ToBoolean(...) to return a std::optional<bool>. it already handles "0" and "1" strings correctly, so this integer conversion stuff is just not doing anything useful
> 
>> Reply to this email directly, view it on GitHub <https://github.com/llvm/llvm-project/pull/79901#pullrequestreview-1850032671>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ADUPVW6RAW4LLT7WOIX4GGLYRA7UVAVCNFSM6AAAAABCQEQH7OVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTQNJQGAZTENRXGE>.
> You are receiving this because your review was requested.
> 



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


More information about the lldb-commits mailing list