From 47cbf4a07bdfe8f5ef56be7a0caf003f91a00a9e Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Tue, 10 Apr 2018 09:03:59 +0000 Subject: Move Args::StringTo*** functions to a new OptionArgParser class Summary: The idea behind this is to move the functionality which depend on other lldb classes into a separate class. This way, the Args class can be turned into a lightweight arc+argv wrapper and moved into the lower lldb layers. Reviewers: jingham, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D44306 llvm-svn: 329677 --- lldb/source/Commands/CommandObjectThread.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'lldb/source/Commands/CommandObjectThread.cpp') diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp index b68aa920b58..43c5c5446f5 100644 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -21,6 +21,7 @@ #include "lldb/Host/StringConvert.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" +#include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Interpreter/Options.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/Function.h" @@ -290,7 +291,7 @@ public: case 'e': { bool success; m_extended_backtrace = - Args::StringToBoolean(option_arg, false, &success); + OptionArgParser::ToBoolean(option_arg, false, &success); if (!success) error.SetErrorStringWithFormat( "invalid boolean value for option '%c'", short_option); @@ -447,7 +448,8 @@ public: switch (short_option) { case 'a': { bool success; - bool avoid_no_debug = Args::StringToBoolean(option_arg, true, &success); + bool avoid_no_debug = + OptionArgParser::ToBoolean(option_arg, true, &success); if (!success) error.SetErrorStringWithFormat( "invalid boolean value for option '%c'", short_option); @@ -459,7 +461,8 @@ public: case 'A': { bool success; - bool avoid_no_debug = Args::StringToBoolean(option_arg, true, &success); + bool avoid_no_debug = + OptionArgParser::ToBoolean(option_arg, true, &success); if (!success) error.SetErrorStringWithFormat( "invalid boolean value for option '%c'", short_option); @@ -483,7 +486,7 @@ public: case 'm': { OptionEnumValueElement *enum_values = GetDefinitions()[option_idx].enum_values; - m_run_mode = (lldb::RunMode)Args::StringToOptionEnum( + m_run_mode = (lldb::RunMode)OptionArgParser::ToOptionEnum( option_arg, enum_values, eOnlyDuringStepping, error); } break; @@ -1030,7 +1033,7 @@ public: switch (short_option) { case 'a': { - lldb::addr_t tmp_addr = Args::StringToAddress( + lldb::addr_t tmp_addr = OptionArgParser::ToAddress( execution_context, option_arg, LLDB_INVALID_ADDRESS, &error); if (error.Success()) m_until_addrs.push_back(tmp_addr); @@ -1052,7 +1055,7 @@ public: case 'm': { OptionEnumValueElement *enum_values = GetDefinitions()[option_idx].enum_values; - lldb::RunMode run_mode = (lldb::RunMode)Args::StringToOptionEnum( + lldb::RunMode run_mode = (lldb::RunMode)OptionArgParser::ToOptionEnum( option_arg, enum_values, eOnlyDuringStepping, error); if (error.Success()) { @@ -1541,7 +1544,8 @@ public: switch (short_option) { case 'x': { bool success; - bool tmp_value = Args::StringToBoolean(option_arg, false, &success); + bool tmp_value = + OptionArgParser::ToBoolean(option_arg, false, &success); if (success) m_from_expression = tmp_value; else { @@ -1737,8 +1741,8 @@ public: return Status("invalid line offset: '%s'.", option_arg.str().c_str()); break; case 'a': - m_load_addr = Args::StringToAddress(execution_context, option_arg, - LLDB_INVALID_ADDRESS, &error); + m_load_addr = OptionArgParser::ToAddress(execution_context, option_arg, + LLDB_INVALID_ADDRESS, &error); break; case 'r': m_force = true; -- cgit v1.2.3