summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectExpression.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Commands/CommandObjectExpression.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectExpression.cpp51
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;
}
OpenPOWER on IntegriCloud