summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/lldb/source/Interpreter/OptionValueBoolean.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Interpreter/OptionValueBoolean.cpp')
-rw-r--r--contrib/llvm/tools/lldb/source/Interpreter/OptionValueBoolean.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueBoolean.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueBoolean.cpp
index 71cc2af..dae1f4b 100644
--- a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueBoolean.cpp
+++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueBoolean.cpp
@@ -37,7 +37,7 @@ OptionValueBoolean::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, ui
}
Error
-OptionValueBoolean::SetValueFromCString (const char *value_cstr,
+OptionValueBoolean::SetValueFromString (llvm::StringRef value_str,
VarSetOperationType op)
{
Error error;
@@ -52,7 +52,7 @@ OptionValueBoolean::SetValueFromCString (const char *value_cstr,
case eVarSetOperationAssign:
{
bool success = false;
- bool value = Args::StringToBoolean(value_cstr, false, &success);
+ bool value = Args::StringToBoolean(value_str.str().c_str(), false, &success);
if (success)
{
m_value_was_set = true;
@@ -61,12 +61,11 @@ OptionValueBoolean::SetValueFromCString (const char *value_cstr,
}
else
{
- if (value_cstr == nullptr)
- error.SetErrorString ("invalid boolean string value: NULL");
- else if (value_cstr[0] == '\0')
+ if (value_str.size() == 0)
error.SetErrorString ("invalid boolean string value <empty>");
else
- error.SetErrorStringWithFormat ("invalid boolean string value: '%s'", value_cstr);
+ error.SetErrorStringWithFormat ("invalid boolean string value: '%s'",
+ value_str.str().c_str());
}
}
break;
@@ -76,7 +75,7 @@ OptionValueBoolean::SetValueFromCString (const char *value_cstr,
case eVarSetOperationRemove:
case eVarSetOperationAppend:
case eVarSetOperationInvalid:
- error = OptionValue::SetValueFromCString (value_cstr, op);
+ error = OptionValue::SetValueFromString (value_str, op);
break;
}
return error;
OpenPOWER on IntegriCloud