forked from OSchip/llvm-project
Refactor OptionValue::SetValueFromCString to use llvm::StringRef
Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D7676 llvm-svn: 230005
This commit is contained in:
parent
0c5f059865
commit
c95f7e2a7c
lldb
include/lldb/Interpreter
OptionValue.hOptionValueArch.hOptionValueArray.hOptionValueBoolean.hOptionValueChar.hOptionValueDictionary.hOptionValueEnumeration.hOptionValueFileSpec.hOptionValueFileSpecList.hOptionValueFormat.hOptionValueFormatEntity.hOptionValuePathMappings.hOptionValueProperties.hOptionValueRegex.hOptionValueSInt64.hOptionValueString.hOptionValueUInt64.hOptionValueUUID.h
source
Commands
Core
Interpreter
OptionGroupBoolean.cppOptionGroupFile.cppOptionGroupFormat.cppOptionGroupOutputFile.cppOptionGroupString.cppOptionGroupUInt64.cppOptionGroupUUID.cppOptionValue.cppOptionValueArch.cppOptionValueArray.cppOptionValueBoolean.cppOptionValueChar.cppOptionValueDictionary.cppOptionValueEnumeration.cppOptionValueFileSpec.cppOptionValueFileSpecLIst.cppOptionValueFormat.cppOptionValueFormatEntity.cppOptionValuePathMappings.cppOptionValueProperties.cppOptionValueRegex.cppOptionValueSInt64.cppOptionValueString.cppOptionValueUInt64.cppOptionValueUUID.cppProperty.cpp
|
@ -106,7 +106,7 @@ namespace lldb_private {
|
|||
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) = 0;
|
||||
|
||||
virtual Error
|
||||
SetValueFromCString (const char *value, VarSetOperationType op = eVarSetOperationAssign);
|
||||
SetValueFromString (llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign);
|
||||
|
||||
virtual bool
|
||||
Clear () = 0;
|
||||
|
|
|
@ -71,7 +71,7 @@ public:
|
|||
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
|
||||
|
||||
virtual Error
|
||||
SetValueFromCString (const char *value,
|
||||
SetValueFromString (llvm::StringRef value,
|
||||
VarSetOperationType op = eVarSetOperationAssign);
|
||||
|
||||
virtual bool
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
|
||||
|
||||
virtual Error
|
||||
SetValueFromCString (const char *value,
|
||||
SetValueFromString (llvm::StringRef value,
|
||||
VarSetOperationType op = eVarSetOperationAssign);
|
||||
|
||||
virtual bool
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
|
||||
|
||||
virtual Error
|
||||
SetValueFromCString (const char *value,
|
||||
SetValueFromString (llvm::StringRef value,
|
||||
VarSetOperationType op = eVarSetOperationAssign);
|
||||
|
||||
virtual bool
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
|
||||
|
||||
virtual Error
|
||||
SetValueFromCString (const char *value,
|
||||
SetValueFromString (llvm::StringRef value,
|
||||
VarSetOperationType op = eVarSetOperationAssign);
|
||||
|
||||
virtual bool
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
|
||||
|
||||
virtual Error
|
||||
SetValueFromCString (const char *value,
|
||||
SetValueFromString (llvm::StringRef value,
|
||||
VarSetOperationType op = eVarSetOperationAssign);
|
||||
|
||||
virtual bool
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
|
||||
|
||||
virtual Error
|
||||
SetValueFromCString (const char *value,
|
||||
SetValueFromString (llvm::StringRef value,
|
||||
VarSetOperationType op = eVarSetOperationAssign);
|
||||
|
||||
virtual bool
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
|
||||
|
||||
virtual Error
|
||||
SetValueFromCString (const char *value,
|
||||
SetValueFromString (llvm::StringRef value,
|
||||
VarSetOperationType op = eVarSetOperationAssign);
|
||||
|
||||
virtual bool
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
|
||||
|
||||
virtual Error
|
||||
SetValueFromCString (const char *value,
|
||||
SetValueFromString (llvm::StringRef value,
|
||||
VarSetOperationType op = eVarSetOperationAssign);
|
||||
|
||||
virtual bool
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
|
||||
|
||||
virtual Error
|
||||
SetValueFromCString (const char *value,
|
||||
SetValueFromString (llvm::StringRef value,
|
||||
VarSetOperationType op = eVarSetOperationAssign);
|
||||
|
||||
virtual bool
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
|
||||
|
||||
Error
|
||||
SetValueFromCString (const char *value,
|
||||
SetValueFromString (llvm::StringRef value,
|
||||
VarSetOperationType op = eVarSetOperationAssign) override;
|
||||
|
||||
bool
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
|
||||
|
||||
virtual Error
|
||||
SetValueFromCString (const char *value,
|
||||
SetValueFromString (llvm::StringRef value,
|
||||
VarSetOperationType op = eVarSetOperationAssign);
|
||||
|
||||
virtual bool
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
DeepCopy () const;
|
||||
|
||||
virtual Error
|
||||
SetValueFromCString (const char *value, VarSetOperationType op = eVarSetOperationAssign);
|
||||
SetValueFromString (llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign);
|
||||
|
||||
virtual void
|
||||
DumpValue (const ExecutionContext *exe_ctx,
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
|
||||
|
||||
virtual Error
|
||||
SetValueFromCString (const char *value,
|
||||
SetValueFromString (llvm::StringRef value,
|
||||
VarSetOperationType op = eVarSetOperationAssign);
|
||||
|
||||
virtual bool
|
||||
|
|
|
@ -77,7 +77,7 @@ public:
|
|||
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
|
||||
|
||||
virtual Error
|
||||
SetValueFromCString (const char *value,
|
||||
SetValueFromString (llvm::StringRef value,
|
||||
VarSetOperationType op = eVarSetOperationAssign);
|
||||
|
||||
virtual bool
|
||||
|
|
|
@ -137,7 +137,7 @@ public:
|
|||
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
|
||||
|
||||
virtual Error
|
||||
SetValueFromCString (const char *value,
|
||||
SetValueFromString (llvm::StringRef value,
|
||||
VarSetOperationType op = eVarSetOperationAssign);
|
||||
|
||||
virtual bool
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
|
||||
|
||||
virtual Error
|
||||
SetValueFromCString (const char *value,
|
||||
SetValueFromString (llvm::StringRef value,
|
||||
VarSetOperationType op = eVarSetOperationAssign);
|
||||
|
||||
virtual bool
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
|
||||
|
||||
virtual Error
|
||||
SetValueFromCString (const char *value,
|
||||
SetValueFromString (llvm::StringRef value,
|
||||
VarSetOperationType op = eVarSetOperationAssign);
|
||||
|
||||
virtual bool
|
||||
|
|
|
@ -1950,15 +1950,15 @@ public:
|
|||
{
|
||||
case 'N':
|
||||
if (BreakpointID::StringIsBreakpointName(option_value, error) && error.Success())
|
||||
m_name.SetValueFromCString(option_value);
|
||||
m_name.SetValueFromString(option_value);
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
if (m_breakpoint.SetValueFromCString(option_value).Fail())
|
||||
if (m_breakpoint.SetValueFromString(option_value).Fail())
|
||||
error.SetErrorStringWithFormat ("unrecognized value \"%s\" for breakpoint", option_value);
|
||||
break;
|
||||
case 'D':
|
||||
if (m_use_dummy.SetValueFromCString(option_value).Fail())
|
||||
if (m_use_dummy.SetValueFromString(option_value).Fail())
|
||||
error.SetErrorStringWithFormat ("unrecognized value \"%s\" for use-dummy", option_value);
|
||||
break;
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ protected:
|
|||
switch (short_option)
|
||||
{
|
||||
case 'c':
|
||||
error = m_count.SetValueFromCString(option_arg,eVarSetOperationAssign);
|
||||
error = m_count.SetValueFromString(option_arg,eVarSetOperationAssign);
|
||||
break;
|
||||
case 's':
|
||||
if (option_arg && strcmp("end", option_arg) == 0)
|
||||
|
@ -94,10 +94,10 @@ protected:
|
|||
m_start_idx.SetOptionWasSet();
|
||||
}
|
||||
else
|
||||
error = m_start_idx.SetValueFromCString(option_arg,eVarSetOperationAssign);
|
||||
error = m_start_idx.SetValueFromString(option_arg,eVarSetOperationAssign);
|
||||
break;
|
||||
case 'e':
|
||||
error = m_stop_idx.SetValueFromCString(option_arg,eVarSetOperationAssign);
|
||||
error = m_stop_idx.SetValueFromString(option_arg,eVarSetOperationAssign);
|
||||
break;
|
||||
case 'C':
|
||||
m_clear.SetCurrentValue(true);
|
||||
|
@ -326,15 +326,15 @@ protected:
|
|||
switch (short_option)
|
||||
{
|
||||
case 'e':
|
||||
error = m_stop_on_error.SetValueFromCString(option_arg);
|
||||
error = m_stop_on_error.SetValueFromString(option_arg);
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
error = m_stop_on_continue.SetValueFromCString(option_arg);
|
||||
error = m_stop_on_continue.SetValueFromString(option_arg);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
error = m_silent_run.SetValueFromCString(option_arg);
|
||||
error = m_silent_run.SetValueFromString(option_arg);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -95,7 +95,7 @@ public:
|
|||
switch (short_option)
|
||||
{
|
||||
case 'l':
|
||||
error = m_num_per_line.SetValueFromCString (option_arg);
|
||||
error = m_num_per_line.SetValueFromString (option_arg);
|
||||
if (m_num_per_line.GetCurrentValue() == 0)
|
||||
error.SetErrorStringWithFormat("invalid value for --num-per-line option '%s'", option_arg);
|
||||
break;
|
||||
|
@ -105,7 +105,7 @@ public:
|
|||
break;
|
||||
|
||||
case 't':
|
||||
error = m_view_as_type.SetValueFromCString (option_arg);
|
||||
error = m_view_as_type.SetValueFromString (option_arg);
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
|
@ -981,20 +981,20 @@ public:
|
|||
switch (short_option)
|
||||
{
|
||||
case 'e':
|
||||
m_expr.SetValueFromCString(option_arg);
|
||||
m_expr.SetValueFromString(option_arg);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
m_string.SetValueFromCString(option_arg);
|
||||
m_string.SetValueFromString(option_arg);
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
if (m_count.SetValueFromCString(option_arg).Fail())
|
||||
if (m_count.SetValueFromString(option_arg).Fail())
|
||||
error.SetErrorString("unrecognized value for count");
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
if (m_offset.SetValueFromCString(option_arg).Fail())
|
||||
if (m_offset.SetValueFromString(option_arg).Fail())
|
||||
error.SetErrorString("unrecognized value for dump-offset");
|
||||
break;
|
||||
|
||||
|
|
|
@ -726,7 +726,7 @@ Instruction::ReadArray (FILE *in_file, Stream *out_stream, OptionValue::Type dat
|
|||
{
|
||||
case OptionValue::eTypeUInt64:
|
||||
data_value_sp.reset (new OptionValueUInt64 (0, 0));
|
||||
data_value_sp->SetValueFromCString (value.c_str());
|
||||
data_value_sp->SetValueFromString (value);
|
||||
break;
|
||||
// Other types can be added later as needed.
|
||||
default:
|
||||
|
@ -834,7 +834,7 @@ Instruction::ReadDictionary (FILE *in_file, Stream *out_stream)
|
|||
else if ((value[0] == '0') && (value[1] == 'x'))
|
||||
{
|
||||
value_sp.reset (new OptionValueUInt64 (0, 0));
|
||||
value_sp->SetValueFromCString (value.c_str());
|
||||
value_sp->SetValueFromString (value);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -56,7 +56,7 @@ OptionGroupBoolean::SetOptionValue (CommandInterpreter &interpreter,
|
|||
}
|
||||
else
|
||||
{
|
||||
error = m_value.SetValueFromCString (option_arg);
|
||||
error = m_value.SetValueFromString (option_arg);
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ OptionGroupFile::SetOptionValue (CommandInterpreter &interpreter,
|
|||
uint32_t option_idx,
|
||||
const char *option_arg)
|
||||
{
|
||||
Error error (m_file.SetValueFromCString (option_arg));
|
||||
Error error (m_file.SetValueFromString (option_arg));
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ OptionGroupFileList::SetOptionValue (CommandInterpreter &interpreter,
|
|||
uint32_t option_idx,
|
||||
const char *option_arg)
|
||||
{
|
||||
Error error (m_file_list.SetValueFromCString (option_arg));
|
||||
Error error (m_file_list.SetValueFromString (option_arg));
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ OptionGroupFormat::SetOptionValue (CommandInterpreter &interpreter,
|
|||
switch (short_option)
|
||||
{
|
||||
case 'f':
|
||||
error = m_format.SetValueFromCString (option_arg);
|
||||
error = m_format.SetValueFromString (option_arg);
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
|
@ -88,7 +88,7 @@ OptionGroupFormat::SetOptionValue (CommandInterpreter &interpreter,
|
|||
}
|
||||
else
|
||||
{
|
||||
error = m_count.SetValueFromCString (option_arg);
|
||||
error = m_count.SetValueFromString (option_arg);
|
||||
if (m_count.GetCurrentValue() == 0)
|
||||
error.SetErrorStringWithFormat("invalid --count option value '%s'", option_arg);
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ OptionGroupFormat::SetOptionValue (CommandInterpreter &interpreter,
|
|||
}
|
||||
else
|
||||
{
|
||||
error = m_byte_size.SetValueFromCString (option_arg);
|
||||
error = m_byte_size.SetValueFromString (option_arg);
|
||||
if (m_byte_size.GetCurrentValue() == 0)
|
||||
error.SetErrorStringWithFormat("invalid --size option value '%s'", option_arg);
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ OptionGroupOutputFile::SetOptionValue (CommandInterpreter &interpreter,
|
|||
switch (short_option)
|
||||
{
|
||||
case 'o':
|
||||
error = m_file.SetValueFromCString (option_arg);
|
||||
error = m_file.SetValueFromString (option_arg);
|
||||
break;
|
||||
|
||||
case SHORT_OPTION_APND:
|
||||
|
|
|
@ -48,7 +48,7 @@ OptionGroupString::SetOptionValue (CommandInterpreter &interpreter,
|
|||
uint32_t option_idx,
|
||||
const char *option_arg)
|
||||
{
|
||||
Error error (m_value.SetValueFromCString (option_arg));
|
||||
Error error (m_value.SetValueFromString (option_arg));
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ OptionGroupUInt64::SetOptionValue (CommandInterpreter &interpreter,
|
|||
uint32_t option_idx,
|
||||
const char *option_arg)
|
||||
{
|
||||
Error error (m_value.SetValueFromCString (option_arg));
|
||||
Error error (m_value.SetValueFromString (option_arg));
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ OptionGroupUUID::SetOptionValue (CommandInterpreter &interpreter,
|
|||
switch (short_option)
|
||||
{
|
||||
case 'u':
|
||||
error = m_uuid.SetValueFromCString (option_arg);
|
||||
error = m_uuid.SetValueFromString (option_arg);
|
||||
if (error.Success())
|
||||
m_uuid.SetOptionWasSet();
|
||||
break;
|
||||
|
|
|
@ -622,7 +622,7 @@ OptionValue::CreateValueFromCStringForTypeMask (const char *value_cstr, uint32_t
|
|||
}
|
||||
|
||||
if (value_sp)
|
||||
error = value_sp->SetValueFromCString (value_cstr, eVarSetOperationAssign);
|
||||
error = value_sp->SetValueFromString (value_cstr, eVarSetOperationAssign);
|
||||
else
|
||||
error.SetErrorString("unsupported type mask");
|
||||
return value_sp;
|
||||
|
@ -664,7 +664,7 @@ OptionValue::AutoComplete (CommandInterpreter &interpreter,
|
|||
}
|
||||
|
||||
Error
|
||||
OptionValue::SetValueFromCString (const char *value, VarSetOperationType op)
|
||||
OptionValue::SetValueFromString (llvm::StringRef value, VarSetOperationType op)
|
||||
{
|
||||
Error error;
|
||||
switch (op)
|
||||
|
|
|
@ -43,7 +43,7 @@ OptionValueArch::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint3
|
|||
}
|
||||
|
||||
Error
|
||||
OptionValueArch::SetValueFromCString (const char *value_cstr, VarSetOperationType op)
|
||||
OptionValueArch::SetValueFromString (llvm::StringRef value, VarSetOperationType op)
|
||||
{
|
||||
Error error;
|
||||
switch (op)
|
||||
|
@ -55,30 +55,23 @@ OptionValueArch::SetValueFromCString (const char *value_cstr, VarSetOperationTyp
|
|||
|
||||
case eVarSetOperationReplace:
|
||||
case eVarSetOperationAssign:
|
||||
if (value_cstr)
|
||||
{
|
||||
std::string value = llvm::StringRef(value_cstr).trim().str();
|
||||
value_cstr = value.c_str();
|
||||
if (m_current_value.SetTriple (value_cstr))
|
||||
std::string value_str = value.trim().str();
|
||||
if (m_current_value.SetTriple (value_str.c_str()))
|
||||
{
|
||||
m_value_was_set = true;
|
||||
NotifyValueChanged();
|
||||
}
|
||||
else
|
||||
error.SetErrorStringWithFormat("unsupported architecture '%s'", value_cstr);
|
||||
error.SetErrorStringWithFormat("unsupported architecture '%s'", value_str.c_str());
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
error.SetErrorString("invalid value string");
|
||||
}
|
||||
break;
|
||||
|
||||
case eVarSetOperationInsertBefore:
|
||||
case eVarSetOperationInsertAfter:
|
||||
case eVarSetOperationRemove:
|
||||
case eVarSetOperationAppend:
|
||||
case eVarSetOperationInvalid:
|
||||
error = OptionValue::SetValueFromCString (value_cstr, op);
|
||||
error = OptionValue::SetValueFromString (value, op);
|
||||
break;
|
||||
}
|
||||
return error;
|
||||
|
|
|
@ -74,9 +74,9 @@ OptionValueArray::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint
|
|||
}
|
||||
|
||||
Error
|
||||
OptionValueArray::SetValueFromCString (const char *value, VarSetOperationType op)
|
||||
OptionValueArray::SetValueFromString (llvm::StringRef value, VarSetOperationType op)
|
||||
{
|
||||
Args args(value);
|
||||
Args args(value.str().c_str());
|
||||
Error error = SetArgs (args, op);
|
||||
if (error.Success())
|
||||
NotifyValueChanged();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -39,7 +39,7 @@ OptionValueChar::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint3
|
|||
}
|
||||
|
||||
Error
|
||||
OptionValueChar::SetValueFromCString (const char *value_cstr,
|
||||
OptionValueChar::SetValueFromString (llvm::StringRef value,
|
||||
VarSetOperationType op)
|
||||
{
|
||||
Error error;
|
||||
|
@ -53,19 +53,19 @@ OptionValueChar::SetValueFromCString (const char *value_cstr,
|
|||
case eVarSetOperationAssign:
|
||||
{
|
||||
bool success = false;
|
||||
char char_value = Args::StringToChar(value_cstr, '\0', &success);
|
||||
char char_value = Args::StringToChar(value.str().c_str(), '\0', &success);
|
||||
if (success)
|
||||
{
|
||||
m_current_value = char_value;
|
||||
m_value_was_set = true;
|
||||
}
|
||||
else
|
||||
error.SetErrorStringWithFormat("'%s' cannot be longer than 1 character", value_cstr);
|
||||
error.SetErrorStringWithFormat("'%s' cannot be longer than 1 character", value.str().c_str());
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
error = OptionValue::SetValueFromCString (value_cstr, op);
|
||||
error = OptionValue::SetValueFromString (value.str().c_str(), op);
|
||||
break;
|
||||
}
|
||||
return error;
|
||||
|
|
|
@ -211,16 +211,16 @@ OptionValueDictionary::SetArgs (const Args &args, VarSetOperationType op)
|
|||
case eVarSetOperationInsertBefore:
|
||||
case eVarSetOperationInsertAfter:
|
||||
case eVarSetOperationInvalid:
|
||||
error = OptionValue::SetValueFromCString (nullptr, op);
|
||||
error = OptionValue::SetValueFromString (llvm::StringRef(), op);
|
||||
break;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
Error
|
||||
OptionValueDictionary::SetValueFromCString (const char *value_cstr, VarSetOperationType op)
|
||||
OptionValueDictionary::SetValueFromString (llvm::StringRef value, VarSetOperationType op)
|
||||
{
|
||||
Args args(value_cstr);
|
||||
Args args(value.str().c_str());
|
||||
Error error = SetArgs (args, op);
|
||||
if (error.Success())
|
||||
NotifyValueChanged();
|
||||
|
@ -335,7 +335,7 @@ OptionValueDictionary::SetSubValue (const ExecutionContext *exe_ctx, VarSetOpera
|
|||
const bool will_modify = true;
|
||||
lldb::OptionValueSP value_sp (GetSubValue (exe_ctx, name, will_modify, error));
|
||||
if (value_sp)
|
||||
error = value_sp->SetValueFromCString(value, op);
|
||||
error = value_sp->SetValueFromString(value, op);
|
||||
else
|
||||
{
|
||||
if (error.AsCString() == nullptr)
|
||||
|
@ -381,7 +381,7 @@ OptionValueDictionary::SetStringValueForKey (const ConstString &key,
|
|||
return false;
|
||||
if (pos->second->GetType() == OptionValue::eTypeString)
|
||||
{
|
||||
pos->second->SetValueFromCString(value);
|
||||
pos->second->SetValueFromString(value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ OptionValueEnumeration::DumpValue (const ExecutionContext *exe_ctx, Stream &strm
|
|||
}
|
||||
|
||||
Error
|
||||
OptionValueEnumeration::SetValueFromCString (const char *value, VarSetOperationType op)
|
||||
OptionValueEnumeration::SetValueFromString (llvm::StringRef value, VarSetOperationType op)
|
||||
{
|
||||
Error error;
|
||||
switch (op)
|
||||
|
@ -67,9 +67,8 @@ OptionValueEnumeration::SetValueFromCString (const char *value, VarSetOperationT
|
|||
|
||||
case eVarSetOperationReplace:
|
||||
case eVarSetOperationAssign:
|
||||
if (value && value[0])
|
||||
{
|
||||
ConstString const_enumerator_name(llvm::StringRef(value).trim());
|
||||
ConstString const_enumerator_name(value.trim());
|
||||
const EnumerationMapEntry *enumerator_entry = m_enumerations.FindFirstValueForName (const_enumerator_name.GetCString());
|
||||
if (enumerator_entry)
|
||||
{
|
||||
|
@ -79,7 +78,7 @@ OptionValueEnumeration::SetValueFromCString (const char *value, VarSetOperationT
|
|||
else
|
||||
{
|
||||
StreamString error_strm;
|
||||
error_strm.Printf("invalid enumeration value '%s'", value);
|
||||
error_strm.Printf("invalid enumeration value '%s'", value.str().c_str());
|
||||
const size_t count = m_enumerations.GetSize ();
|
||||
if (count)
|
||||
{
|
||||
|
@ -91,19 +90,15 @@ OptionValueEnumeration::SetValueFromCString (const char *value, VarSetOperationT
|
|||
}
|
||||
error.SetErrorString(error_strm.GetData());
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
error.SetErrorString("invalid enumeration value");
|
||||
}
|
||||
break;
|
||||
|
||||
case eVarSetOperationInsertBefore:
|
||||
case eVarSetOperationInsertAfter:
|
||||
case eVarSetOperationRemove:
|
||||
case eVarSetOperationAppend:
|
||||
case eVarSetOperationInvalid:
|
||||
error = OptionValue::SetValueFromCString (value, op);
|
||||
error = OptionValue::SetValueFromString (value, op);
|
||||
break;
|
||||
}
|
||||
return error;
|
||||
|
|
|
@ -75,7 +75,7 @@ OptionValueFileSpec::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, u
|
|||
}
|
||||
|
||||
Error
|
||||
OptionValueFileSpec::SetValueFromCString (const char *value_cstr,
|
||||
OptionValueFileSpec::SetValueFromString (llvm::StringRef value,
|
||||
VarSetOperationType op)
|
||||
{
|
||||
Error error;
|
||||
|
@ -88,23 +88,16 @@ OptionValueFileSpec::SetValueFromCString (const char *value_cstr,
|
|||
|
||||
case eVarSetOperationReplace:
|
||||
case eVarSetOperationAssign:
|
||||
if (value_cstr && value_cstr[0])
|
||||
if (value.size() > 0)
|
||||
{
|
||||
// The setting value may have whitespace, double-quotes, or single-quotes around the file
|
||||
// path to indicate that internal spaces are not word breaks. Strip off any ws & quotes
|
||||
// from the start and end of the file path - we aren't doing any word // breaking here so
|
||||
// the quoting is unnecessary. NB this will cause a problem if someone tries to specify
|
||||
// a file path that legitimately begins or ends with a " or ' character, or whitespace.
|
||||
std::string filepath(value_cstr);
|
||||
auto prefix_chars_to_trim = filepath.find_first_not_of ("\"' \t");
|
||||
if (prefix_chars_to_trim != std::string::npos && prefix_chars_to_trim > 0)
|
||||
filepath.erase(0, prefix_chars_to_trim);
|
||||
auto suffix_chars_to_trim = filepath.find_last_not_of ("\"' \t");
|
||||
if (suffix_chars_to_trim != std::string::npos && suffix_chars_to_trim < filepath.size())
|
||||
filepath.erase (suffix_chars_to_trim + 1);
|
||||
|
||||
value = value.trim("\"' \t");
|
||||
m_value_was_set = true;
|
||||
m_current_value.SetFile(filepath.c_str(), m_resolve);
|
||||
m_current_value.SetFile(value.str().c_str(), m_resolve);
|
||||
m_data_sp.reset();
|
||||
NotifyValueChanged();
|
||||
}
|
||||
|
@ -119,7 +112,7 @@ OptionValueFileSpec::SetValueFromCString (const char *value_cstr,
|
|||
case eVarSetOperationRemove:
|
||||
case eVarSetOperationAppend:
|
||||
case eVarSetOperationInvalid:
|
||||
error = OptionValue::SetValueFromCString (value_cstr, op);
|
||||
error = OptionValue::SetValueFromString (value, op);
|
||||
break;
|
||||
}
|
||||
return error;
|
||||
|
|
|
@ -42,10 +42,10 @@ OptionValueFileSpecList::DumpValue (const ExecutionContext *exe_ctx, Stream &str
|
|||
}
|
||||
|
||||
Error
|
||||
OptionValueFileSpecList::SetValueFromCString (const char *value, VarSetOperationType op)
|
||||
OptionValueFileSpecList::SetValueFromString (llvm::StringRef value, VarSetOperationType op)
|
||||
{
|
||||
Error error;
|
||||
Args args(value);
|
||||
Args args(value.str().c_str());
|
||||
const size_t argc = args.GetArgumentCount();
|
||||
|
||||
switch (op)
|
||||
|
@ -174,7 +174,7 @@ OptionValueFileSpecList::SetValueFromCString (const char *value, VarSetOperation
|
|||
break;
|
||||
|
||||
case eVarSetOperationInvalid:
|
||||
error = OptionValue::SetValueFromCString (value, op);
|
||||
error = OptionValue::SetValueFromString (value, op);
|
||||
break;
|
||||
}
|
||||
return error;
|
||||
|
|
|
@ -36,7 +36,7 @@ OptionValueFormat::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uin
|
|||
}
|
||||
|
||||
Error
|
||||
OptionValueFormat::SetValueFromCString (const char *value_cstr, VarSetOperationType op)
|
||||
OptionValueFormat::SetValueFromString (llvm::StringRef value, VarSetOperationType op)
|
||||
{
|
||||
Error error;
|
||||
switch (op)
|
||||
|
@ -50,7 +50,7 @@ OptionValueFormat::SetValueFromCString (const char *value_cstr, VarSetOperationT
|
|||
case eVarSetOperationAssign:
|
||||
{
|
||||
Format new_format;
|
||||
error = Args::StringToFormat (value_cstr, new_format, nullptr);
|
||||
error = Args::StringToFormat (value.str().c_str(), new_format, nullptr);
|
||||
if (error.Success())
|
||||
{
|
||||
m_value_was_set = true;
|
||||
|
@ -65,7 +65,7 @@ OptionValueFormat::SetValueFromCString (const char *value_cstr, VarSetOperationT
|
|||
case eVarSetOperationRemove:
|
||||
case eVarSetOperationAppend:
|
||||
case eVarSetOperationInvalid:
|
||||
error = OptionValue::SetValueFromCString (value_cstr, op);
|
||||
error = OptionValue::SetValueFromString (value, op);
|
||||
break;
|
||||
}
|
||||
return error;
|
||||
|
|
|
@ -67,7 +67,7 @@ OptionValueFormatEntity::DumpValue (const ExecutionContext *exe_ctx, Stream &str
|
|||
}
|
||||
|
||||
Error
|
||||
OptionValueFormatEntity::SetValueFromCString (const char *value_cstr,
|
||||
OptionValueFormatEntity::SetValueFromString (llvm::StringRef value_str,
|
||||
VarSetOperationType op)
|
||||
{
|
||||
Error error;
|
||||
|
@ -82,12 +82,11 @@ OptionValueFormatEntity::SetValueFromCString (const char *value_cstr,
|
|||
case eVarSetOperationAssign:
|
||||
{
|
||||
FormatEntity::Entry entry;
|
||||
llvm::StringRef value_str(value_cstr);
|
||||
error = FormatEntity::Parse(value_str, entry);
|
||||
if (error.Success())
|
||||
{
|
||||
m_current_entry = std::move(entry);
|
||||
m_current_format = value_cstr;
|
||||
m_current_format = value_str;
|
||||
m_value_was_set = true;
|
||||
NotifyValueChanged();
|
||||
}
|
||||
|
@ -99,7 +98,7 @@ OptionValueFormatEntity::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;
|
||||
|
|
|
@ -34,10 +34,10 @@ OptionValuePathMappings::DumpValue (const ExecutionContext *exe_ctx, Stream &str
|
|||
}
|
||||
|
||||
Error
|
||||
OptionValuePathMappings::SetValueFromCString (const char *value, VarSetOperationType op)
|
||||
OptionValuePathMappings::SetValueFromString (llvm::StringRef value, VarSetOperationType op)
|
||||
{
|
||||
Error error;
|
||||
Args args(value);
|
||||
Args args(value.str().c_str());
|
||||
const size_t argc = args.GetArgumentCount();
|
||||
|
||||
switch (op)
|
||||
|
@ -175,7 +175,7 @@ OptionValuePathMappings::SetValueFromCString (const char *value, VarSetOperation
|
|||
break;
|
||||
|
||||
case eVarSetOperationInvalid:
|
||||
error = OptionValue::SetValueFromCString (value, op);
|
||||
error = OptionValue::SetValueFromString (value, op);
|
||||
break;
|
||||
}
|
||||
return error;
|
||||
|
|
|
@ -226,7 +226,7 @@ OptionValueProperties::SetSubValue (const ExecutionContext *exe_ctx,
|
|||
const bool will_modify = true;
|
||||
lldb::OptionValueSP value_sp (GetSubValue (exe_ctx, name, will_modify, error));
|
||||
if (value_sp)
|
||||
error = value_sp->SetValueFromCString(value, op);
|
||||
error = value_sp->SetValueFromString(value ? llvm::StringRef(value) : llvm::StringRef(), op);
|
||||
else
|
||||
{
|
||||
if (error.AsCString() == nullptr)
|
||||
|
@ -600,7 +600,7 @@ OptionValueProperties::Clear ()
|
|||
|
||||
|
||||
Error
|
||||
OptionValueProperties::SetValueFromCString (const char *value, VarSetOperationType op)
|
||||
OptionValueProperties::SetValueFromString (llvm::StringRef value, VarSetOperationType op)
|
||||
{
|
||||
Error error;
|
||||
|
||||
|
@ -619,7 +619,7 @@ OptionValueProperties::SetValueFromCString (const char *value, VarSetOperationTy
|
|||
case eVarSetOperationInsertAfter:
|
||||
case eVarSetOperationAppend:
|
||||
case eVarSetOperationInvalid:
|
||||
error = OptionValue::SetValueFromCString (value, op);
|
||||
error = OptionValue::SetValueFromString (value, op);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ OptionValueRegex::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint
|
|||
}
|
||||
|
||||
Error
|
||||
OptionValueRegex::SetValueFromCString (const char *value_cstr,
|
||||
OptionValueRegex::SetValueFromString (llvm::StringRef value,
|
||||
VarSetOperationType op)
|
||||
{
|
||||
Error error;
|
||||
|
@ -52,7 +52,7 @@ OptionValueRegex::SetValueFromCString (const char *value_cstr,
|
|||
case eVarSetOperationInsertAfter:
|
||||
case eVarSetOperationRemove:
|
||||
case eVarSetOperationAppend:
|
||||
error = OptionValue::SetValueFromCString (value_cstr, op);
|
||||
error = OptionValue::SetValueFromString (value, op);
|
||||
break;
|
||||
|
||||
case eVarSetOperationClear:
|
||||
|
@ -62,7 +62,7 @@ OptionValueRegex::SetValueFromCString (const char *value_cstr,
|
|||
|
||||
case eVarSetOperationReplace:
|
||||
case eVarSetOperationAssign:
|
||||
if (m_regex.Compile (value_cstr))
|
||||
if (m_regex.Compile (value.str().c_str()))
|
||||
{
|
||||
m_value_was_set = true;
|
||||
NotifyValueChanged();
|
||||
|
|
|
@ -36,9 +36,8 @@ OptionValueSInt64::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uin
|
|||
}
|
||||
|
||||
Error
|
||||
OptionValueSInt64::SetValueFromCString (const char *value_cstr, VarSetOperationType op)
|
||||
OptionValueSInt64::SetValueFromString (llvm::StringRef value_ref, VarSetOperationType op)
|
||||
{
|
||||
//printf ("%p: SetValueFromCString (s=\"%s\", op=%i)\n", this, value_cstr, op);
|
||||
Error error;
|
||||
switch (op)
|
||||
{
|
||||
|
@ -51,7 +50,7 @@ OptionValueSInt64::SetValueFromCString (const char *value_cstr, VarSetOperationT
|
|||
case eVarSetOperationAssign:
|
||||
{
|
||||
bool success = false;
|
||||
std::string value_str = llvm::StringRef(value_cstr).trim().str();
|
||||
std::string value_str = value_ref.trim().str();
|
||||
int64_t value = StringConvert::ToSInt64 (value_str.c_str(), 0, 0, &success);
|
||||
if (success)
|
||||
{
|
||||
|
@ -69,7 +68,8 @@ OptionValueSInt64::SetValueFromCString (const char *value_cstr, VarSetOperationT
|
|||
}
|
||||
else
|
||||
{
|
||||
error.SetErrorStringWithFormat ("invalid int64_t string value: '%s'", value_cstr);
|
||||
error.SetErrorStringWithFormat ("invalid int64_t string value: '%s'",
|
||||
value_ref.str().c_str());
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -79,7 +79,7 @@ OptionValueSInt64::SetValueFromCString (const char *value_cstr, VarSetOperationT
|
|||
case eVarSetOperationRemove:
|
||||
case eVarSetOperationAppend:
|
||||
case eVarSetOperationInvalid:
|
||||
error = OptionValue::SetValueFromCString (value_cstr, op);
|
||||
error = OptionValue::SetValueFromString (value_ref, op);
|
||||
break;
|
||||
}
|
||||
return error;
|
||||
|
|
|
@ -51,31 +51,30 @@ OptionValueString::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uin
|
|||
}
|
||||
|
||||
Error
|
||||
OptionValueString::SetValueFromCString (const char *value_cstr,
|
||||
OptionValueString::SetValueFromString (llvm::StringRef value,
|
||||
VarSetOperationType op)
|
||||
{
|
||||
Error error;
|
||||
|
||||
std::string value_str_no_quotes;
|
||||
llvm::StringRef trimmed = value_cstr ? llvm::StringRef(value_cstr).trim() : llvm::StringRef();
|
||||
if (trimmed.size() > 0)
|
||||
std::string value_str = value.str();
|
||||
value = value.trim();
|
||||
if (value.size() > 0)
|
||||
{
|
||||
switch (trimmed.front())
|
||||
switch (value.front())
|
||||
{
|
||||
case '"':
|
||||
case '\'':
|
||||
{
|
||||
if (trimmed.size() <= 1 || trimmed.back() != trimmed.front())
|
||||
if (value.size() <= 1 || value.back() != value.front())
|
||||
{
|
||||
error.SetErrorString("mismatched quotes");
|
||||
return error;
|
||||
}
|
||||
trimmed = trimmed.drop_front().drop_back().str();
|
||||
value = value.drop_front().drop_back().str();
|
||||
}
|
||||
break;
|
||||
}
|
||||
value_str_no_quotes = trimmed.str();
|
||||
value_cstr = value_str_no_quotes.c_str();
|
||||
value_str = value.str();
|
||||
}
|
||||
|
||||
switch (op)
|
||||
|
@ -86,26 +85,26 @@ OptionValueString::SetValueFromCString (const char *value_cstr,
|
|||
case eVarSetOperationRemove:
|
||||
if (m_validator)
|
||||
{
|
||||
error = m_validator(value_cstr,m_validator_baton);
|
||||
error = m_validator(value_str.c_str(),m_validator_baton);
|
||||
if (error.Fail())
|
||||
return error;
|
||||
}
|
||||
error = OptionValue::SetValueFromCString (value_cstr, op);
|
||||
error = OptionValue::SetValueFromString (value, op);
|
||||
break;
|
||||
|
||||
case eVarSetOperationAppend:
|
||||
{
|
||||
std::string new_value(m_current_value);
|
||||
if (value_cstr && value_cstr[0])
|
||||
if (value.size() > 0)
|
||||
{
|
||||
if (m_options.Test (eOptionEncodeCharacterEscapeSequences))
|
||||
{
|
||||
std::string str;
|
||||
Args::EncodeEscapeSequences (value_cstr, str);
|
||||
Args::EncodeEscapeSequences (value_str.c_str(), str);
|
||||
new_value.append(str);
|
||||
}
|
||||
else
|
||||
new_value.append(value_cstr);
|
||||
new_value.append(value);
|
||||
}
|
||||
if (m_validator)
|
||||
{
|
||||
|
@ -127,18 +126,18 @@ OptionValueString::SetValueFromCString (const char *value_cstr,
|
|||
case eVarSetOperationAssign:
|
||||
if (m_validator)
|
||||
{
|
||||
error = m_validator(value_cstr,m_validator_baton);
|
||||
error = m_validator(value_str.c_str(), m_validator_baton);
|
||||
if (error.Fail())
|
||||
return error;
|
||||
}
|
||||
m_value_was_set = true;
|
||||
if (m_options.Test (eOptionEncodeCharacterEscapeSequences))
|
||||
{
|
||||
Args::EncodeEscapeSequences (value_cstr, m_current_value);
|
||||
Args::EncodeEscapeSequences (value_str.c_str(), m_current_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetCurrentValue (value_cstr);
|
||||
SetCurrentValue (value_str.c_str());
|
||||
}
|
||||
NotifyValueChanged();
|
||||
break;
|
||||
|
|
|
@ -23,7 +23,7 @@ lldb::OptionValueSP
|
|||
OptionValueUInt64::Create (const char *value_cstr, Error &error)
|
||||
{
|
||||
lldb::OptionValueSP value_sp (new OptionValueUInt64());
|
||||
error = value_sp->SetValueFromCString (value_cstr);
|
||||
error = value_sp->SetValueFromString (value_cstr);
|
||||
if (error.Fail())
|
||||
value_sp.reset();
|
||||
return value_sp;
|
||||
|
@ -44,7 +44,7 @@ OptionValueUInt64::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uin
|
|||
}
|
||||
|
||||
Error
|
||||
OptionValueUInt64::SetValueFromCString (const char *value_cstr, VarSetOperationType op)
|
||||
OptionValueUInt64::SetValueFromString (llvm::StringRef value_ref, VarSetOperationType op)
|
||||
{
|
||||
Error error;
|
||||
switch (op)
|
||||
|
@ -58,7 +58,7 @@ OptionValueUInt64::SetValueFromCString (const char *value_cstr, VarSetOperationT
|
|||
case eVarSetOperationAssign:
|
||||
{
|
||||
bool success = false;
|
||||
std::string value_str = llvm::StringRef(value_cstr).trim().str();
|
||||
std::string value_str = value_ref.trim().str();
|
||||
uint64_t value = StringConvert::ToUInt64 (value_str.c_str(), 0, 0, &success);
|
||||
if (success)
|
||||
{
|
||||
|
@ -68,7 +68,7 @@ OptionValueUInt64::SetValueFromCString (const char *value_cstr, VarSetOperationT
|
|||
}
|
||||
else
|
||||
{
|
||||
error.SetErrorStringWithFormat ("invalid uint64_t string value: '%s'", value_cstr);
|
||||
error.SetErrorStringWithFormat ("invalid uint64_t string value: '%s'", value_str.c_str());
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -78,7 +78,7 @@ OptionValueUInt64::SetValueFromCString (const char *value_cstr, VarSetOperationT
|
|||
case eVarSetOperationRemove:
|
||||
case eVarSetOperationAppend:
|
||||
case eVarSetOperationInvalid:
|
||||
error = OptionValue::SetValueFromCString (value_cstr, op);
|
||||
error = OptionValue::SetValueFromString (value_ref, op);
|
||||
break;
|
||||
}
|
||||
return error;
|
||||
|
|
|
@ -37,7 +37,7 @@ OptionValueUUID::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint3
|
|||
}
|
||||
|
||||
Error
|
||||
OptionValueUUID::SetValueFromCString (const char *value_cstr,
|
||||
OptionValueUUID::SetValueFromString (llvm::StringRef value,
|
||||
VarSetOperationType op)
|
||||
{
|
||||
Error error;
|
||||
|
@ -51,8 +51,8 @@ OptionValueUUID::SetValueFromCString (const char *value_cstr,
|
|||
case eVarSetOperationReplace:
|
||||
case eVarSetOperationAssign:
|
||||
{
|
||||
if (m_uuid.SetFromCString(value_cstr) == 0)
|
||||
error.SetErrorStringWithFormat ("invalid uuid string value '%s'", value_cstr);
|
||||
if (m_uuid.SetFromCString(value.str().c_str()) == 0)
|
||||
error.SetErrorStringWithFormat ("invalid uuid string value '%s'", value.str().c_str());
|
||||
else
|
||||
{
|
||||
m_value_was_set = true;
|
||||
|
@ -66,7 +66,7 @@ OptionValueUUID::SetValueFromCString (const char *value_cstr,
|
|||
case eVarSetOperationRemove:
|
||||
case eVarSetOperationAppend:
|
||||
case eVarSetOperationInvalid:
|
||||
error = OptionValue::SetValueFromCString (value_cstr, op);
|
||||
error = OptionValue::SetValueFromString (value, op);
|
||||
break;
|
||||
}
|
||||
return error;
|
||||
|
|
|
@ -80,11 +80,11 @@ Property::Property (const PropertyDefinition &definition) :
|
|||
m_value_sp.reset (enum_value);
|
||||
if (definition.default_cstr_value)
|
||||
{
|
||||
if (enum_value->SetValueFromCString(definition.default_cstr_value).Success())
|
||||
if (enum_value->SetValueFromString(definition.default_cstr_value).Success())
|
||||
{
|
||||
enum_value->SetDefaultValue(enum_value->GetCurrentValue());
|
||||
// Call Clear() since we don't want the value to appear as
|
||||
// having been set since we called SetValueFromCString() above.
|
||||
// having been set since we called SetValueFromString() above.
|
||||
// Clear will set the current value to the default and clear
|
||||
// the boolean that says that the value has been set.
|
||||
enum_value->Clear();
|
||||
|
|
Loading…
Reference in New Issue