diff options
author | Zachary Turner <zturner@google.com> | 2016-09-23 17:48:13 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2016-09-23 17:48:13 +0000 |
commit | 8cef4b0bb4bae8598efa7cd1274e54f534b0f4a4 (patch) | |
tree | 1ce2972876d13303fcd7f12d5774f806921d3421 /lldb/source/Commands/CommandObjectExpression.cpp | |
parent | 6c46efba7818644ddab8d8c52940583c0672fd98 (diff) | |
download | bcm5719-llvm-8cef4b0bb4bae8598efa7cd1274e54f534b0f4a4.tar.gz bcm5719-llvm-8cef4b0bb4bae8598efa7cd1274e54f534b0f4a4.zip |
Update OptionGroup::SetValue to take StringRef.
Then deal with all the fallout.
Differential Revision: https://reviews.llvm.org/D24847
llvm-svn: 282265
Diffstat (limited to 'lldb/source/Commands/CommandObjectExpression.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectExpression.cpp | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index 4a041df24f1..11a4721a924 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -70,11 +70,10 @@ static OptionDefinition g_expression_options[] = { }; Error CommandObjectExpression::CommandOptions::SetOptionValue( - uint32_t option_idx, const char *option_arg, + uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) { Error error; - auto option_strref = llvm::StringRef::withNullAsEmpty(option_arg); const int short_option = GetDefinitions()[option_idx].short_option; switch (short_option) { @@ -82,66 +81,68 @@ Error CommandObjectExpression::CommandOptions::SetOptionValue( language = Language::GetLanguageTypeFromString(option_arg); if (language == eLanguageTypeUnknown) error.SetErrorStringWithFormat( - "unknown language type: '%s' for expression", option_arg); + "unknown language type: '%s' for expression", + option_arg.str().c_str()); break; case 'a': { bool success; bool result; - result = Args::StringToBoolean(option_strref, true, &success); + result = Args::StringToBoolean(option_arg, true, &success); if (!success) error.SetErrorStringWithFormat( - "invalid all-threads value setting: \"%s\"", option_arg); + "invalid all-threads value setting: \"%s\"", + option_arg.str().c_str()); else try_all_threads = result; } break; case 'i': { bool success; - bool tmp_value = Args::StringToBoolean(option_strref, true, &success); + bool tmp_value = Args::StringToBoolean(option_arg, true, &success); if (success) ignore_breakpoints = tmp_value; else error.SetErrorStringWithFormat( - "could not convert \"%s\" to a boolean value.", option_arg); + "could not convert \"%s\" to a boolean value.", + option_arg.str().c_str()); break; } case 'j': { bool success; - bool tmp_value = Args::StringToBoolean(option_strref, true, &success); + bool tmp_value = Args::StringToBoolean(option_arg, true, &success); if (success) allow_jit = tmp_value; else error.SetErrorStringWithFormat( - "could not convert \"%s\" to a boolean value.", option_arg); + "could not convert \"%s\" to a boolean value.", + option_arg.str().c_str()); break; } - case 't': { - bool success; - uint32_t result; - result = StringConvert::ToUInt32(option_arg, 0, 0, &success); - if (success) - timeout = result; - else + case 't': + if (option_arg.getAsInteger(0, timeout)) { + timeout = 0; error.SetErrorStringWithFormat("invalid timeout setting \"%s\"", - option_arg); - } break; + option_arg.str().c_str()); + } + break; case 'u': { bool success; - bool tmp_value = Args::StringToBoolean(option_strref, true, &success); + bool tmp_value = Args::StringToBoolean(option_arg, true, &success); if (success) unwind_on_error = tmp_value; else error.SetErrorStringWithFormat( - "could not convert \"%s\" to a boolean value.", option_arg); + "could not convert \"%s\" to a boolean value.", + option_arg.str().c_str()); break; } case 'v': - if (!option_arg) { + if (!option_arg.empty()) { m_verbosity = eLanguageRuntimeDescriptionDisplayVerbosityFull; break; } @@ -150,7 +151,8 @@ Error CommandObjectExpression::CommandOptions::SetOptionValue( option_arg, GetDefinitions()[option_idx].enum_values, 0, error); if (!error.Success()) error.SetErrorStringWithFormat( - "unrecognized value for description-verbosity '%s'", option_arg); + "unrecognized value for description-verbosity '%s'", + option_arg.str().c_str()); break; case 'g': @@ -165,12 +167,13 @@ Error CommandObjectExpression::CommandOptions::SetOptionValue( case 'X': { bool success; - bool tmp_value = Args::StringToBoolean(option_strref, true, &success); + bool tmp_value = Args::StringToBoolean(option_arg, true, &success); if (success) auto_apply_fixits = tmp_value ? eLazyBoolYes : eLazyBoolNo; else error.SetErrorStringWithFormat( - "could not convert \"%s\" to a boolean value.", option_arg); + "could not convert \"%s\" to a boolean value.", + option_arg.str().c_str()); break; } |