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
This commit is contained in:
Pavel Labath
2018-04-10 09:03:59 +00:00
parent bfa20dddcb
commit 47cbf4a07b
35 changed files with 555 additions and 454 deletions

View File

@@ -16,6 +16,7 @@
#include "lldb/DataFormatters/ValueObjectPrinter.h"
#include "lldb/Host/OptionParser.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/OptionArgParser.h"
#include "lldb/Target/Target.h"
#include "llvm/ADT/ArrayRef.h"
@@ -85,8 +86,8 @@ Status OptionGroupValueObjectDisplay::SetOptionValue(
switch (short_option) {
case 'd': {
int32_t result;
result =
Args::StringToOptionEnum(option_arg, g_dynamic_value_types, 2, error);
result = OptionArgParser::ToOptionEnum(option_arg, g_dynamic_value_types, 2,
error);
if (error.Success())
use_dynamic = (lldb::DynamicValueType)result;
} break;
@@ -144,14 +145,14 @@ Status OptionGroupValueObjectDisplay::SetOptionValue(
break;
case 'S':
use_synth = Args::StringToBoolean(option_arg, true, &success);
use_synth = OptionArgParser::ToBoolean(option_arg, true, &success);
if (!success)
error.SetErrorStringWithFormat("invalid synthetic-type '%s'",
option_arg.str().c_str());
break;
case 'V':
run_validator = Args::StringToBoolean(option_arg, true, &success);
run_validator = OptionArgParser::ToBoolean(option_arg, true, &success);
if (!success)
error.SetErrorStringWithFormat("invalid validate '%s'",
option_arg.str().c_str());