diff --git a/lldb/include/lldb/Interpreter/OptionValue.h b/lldb/include/lldb/Interpreter/OptionValue.h index 787430a96ef5..8ca7b94c3206 100644 --- a/lldb/include/lldb/Interpreter/OptionValue.h +++ b/lldb/include/lldb/Interpreter/OptionValue.h @@ -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; diff --git a/lldb/include/lldb/Interpreter/OptionValueArch.h b/lldb/include/lldb/Interpreter/OptionValueArch.h index 662e1ec9f627..3d5d72619efc 100644 --- a/lldb/include/lldb/Interpreter/OptionValueArch.h +++ b/lldb/include/lldb/Interpreter/OptionValueArch.h @@ -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 diff --git a/lldb/include/lldb/Interpreter/OptionValueArray.h b/lldb/include/lldb/Interpreter/OptionValueArray.h index 39ae2f6f43d6..2e44f9f07438 100644 --- a/lldb/include/lldb/Interpreter/OptionValueArray.h +++ b/lldb/include/lldb/Interpreter/OptionValueArray.h @@ -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 diff --git a/lldb/include/lldb/Interpreter/OptionValueBoolean.h b/lldb/include/lldb/Interpreter/OptionValueBoolean.h index e024f3a0f3db..214fd1649d39 100644 --- a/lldb/include/lldb/Interpreter/OptionValueBoolean.h +++ b/lldb/include/lldb/Interpreter/OptionValueBoolean.h @@ -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 diff --git a/lldb/include/lldb/Interpreter/OptionValueChar.h b/lldb/include/lldb/Interpreter/OptionValueChar.h index 55f4b63538ea..8fc02093e3d9 100644 --- a/lldb/include/lldb/Interpreter/OptionValueChar.h +++ b/lldb/include/lldb/Interpreter/OptionValueChar.h @@ -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 diff --git a/lldb/include/lldb/Interpreter/OptionValueDictionary.h b/lldb/include/lldb/Interpreter/OptionValueDictionary.h index 5fb698b9f221..efa15dd6ef88 100644 --- a/lldb/include/lldb/Interpreter/OptionValueDictionary.h +++ b/lldb/include/lldb/Interpreter/OptionValueDictionary.h @@ -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 diff --git a/lldb/include/lldb/Interpreter/OptionValueEnumeration.h b/lldb/include/lldb/Interpreter/OptionValueEnumeration.h index 68beddfce0d0..e820729385de 100644 --- a/lldb/include/lldb/Interpreter/OptionValueEnumeration.h +++ b/lldb/include/lldb/Interpreter/OptionValueEnumeration.h @@ -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 diff --git a/lldb/include/lldb/Interpreter/OptionValueFileSpec.h b/lldb/include/lldb/Interpreter/OptionValueFileSpec.h index 9d2da68927e1..4265fdb737b1 100644 --- a/lldb/include/lldb/Interpreter/OptionValueFileSpec.h +++ b/lldb/include/lldb/Interpreter/OptionValueFileSpec.h @@ -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 diff --git a/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h b/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h index 792de4e23af6..a105d22e45f9 100644 --- a/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h +++ b/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h @@ -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 diff --git a/lldb/include/lldb/Interpreter/OptionValueFormat.h b/lldb/include/lldb/Interpreter/OptionValueFormat.h index 245b2eeb5af1..06ed12854318 100644 --- a/lldb/include/lldb/Interpreter/OptionValueFormat.h +++ b/lldb/include/lldb/Interpreter/OptionValueFormat.h @@ -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 diff --git a/lldb/include/lldb/Interpreter/OptionValueFormatEntity.h b/lldb/include/lldb/Interpreter/OptionValueFormatEntity.h index cc988998bda0..18ace3a6a1b6 100644 --- a/lldb/include/lldb/Interpreter/OptionValueFormatEntity.h +++ b/lldb/include/lldb/Interpreter/OptionValueFormatEntity.h @@ -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 diff --git a/lldb/include/lldb/Interpreter/OptionValuePathMappings.h b/lldb/include/lldb/Interpreter/OptionValuePathMappings.h index 7ebf4947c6af..7b476a9cd366 100644 --- a/lldb/include/lldb/Interpreter/OptionValuePathMappings.h +++ b/lldb/include/lldb/Interpreter/OptionValuePathMappings.h @@ -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 diff --git a/lldb/include/lldb/Interpreter/OptionValueProperties.h b/lldb/include/lldb/Interpreter/OptionValueProperties.h index 6f7f4995ed15..405beefff6d1 100644 --- a/lldb/include/lldb/Interpreter/OptionValueProperties.h +++ b/lldb/include/lldb/Interpreter/OptionValueProperties.h @@ -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, diff --git a/lldb/include/lldb/Interpreter/OptionValueRegex.h b/lldb/include/lldb/Interpreter/OptionValueRegex.h index 295bb98b69e6..5e04218dbfdf 100644 --- a/lldb/include/lldb/Interpreter/OptionValueRegex.h +++ b/lldb/include/lldb/Interpreter/OptionValueRegex.h @@ -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 diff --git a/lldb/include/lldb/Interpreter/OptionValueSInt64.h b/lldb/include/lldb/Interpreter/OptionValueSInt64.h index 8bc8fb2da2d5..36ae97ccfcf8 100644 --- a/lldb/include/lldb/Interpreter/OptionValueSInt64.h +++ b/lldb/include/lldb/Interpreter/OptionValueSInt64.h @@ -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 diff --git a/lldb/include/lldb/Interpreter/OptionValueString.h b/lldb/include/lldb/Interpreter/OptionValueString.h index a82e1403b74b..c75745d402be 100644 --- a/lldb/include/lldb/Interpreter/OptionValueString.h +++ b/lldb/include/lldb/Interpreter/OptionValueString.h @@ -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 diff --git a/lldb/include/lldb/Interpreter/OptionValueUInt64.h b/lldb/include/lldb/Interpreter/OptionValueUInt64.h index 9b5496f9835c..51ff8818dcff 100644 --- a/lldb/include/lldb/Interpreter/OptionValueUInt64.h +++ b/lldb/include/lldb/Interpreter/OptionValueUInt64.h @@ -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 diff --git a/lldb/include/lldb/Interpreter/OptionValueUUID.h b/lldb/include/lldb/Interpreter/OptionValueUUID.h index caf436e576f5..c6ab48a627f6 100644 --- a/lldb/include/lldb/Interpreter/OptionValueUUID.h +++ b/lldb/include/lldb/Interpreter/OptionValueUUID.h @@ -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 diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp index b4a6b48cabfc..e36809f485fe 100644 --- a/lldb/source/Commands/CommandObjectBreakpoint.cpp +++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp @@ -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; diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp index f98eac055f24..0740329069fa 100644 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -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: diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp index dac6dd81651b..1adfe9dbc22b 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -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; diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp index 87ded9ff18d0..46d453d5cfcf 100644 --- a/lldb/source/Core/Disassembler.cpp +++ b/lldb/source/Core/Disassembler.cpp @@ -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 { diff --git a/lldb/source/Interpreter/OptionGroupBoolean.cpp b/lldb/source/Interpreter/OptionGroupBoolean.cpp index 0c502cc364b4..6bd2743a6681 100644 --- a/lldb/source/Interpreter/OptionGroupBoolean.cpp +++ b/lldb/source/Interpreter/OptionGroupBoolean.cpp @@ -56,7 +56,7 @@ OptionGroupBoolean::SetOptionValue (CommandInterpreter &interpreter, } else { - error = m_value.SetValueFromCString (option_arg); + error = m_value.SetValueFromString (option_arg); } return error; } diff --git a/lldb/source/Interpreter/OptionGroupFile.cpp b/lldb/source/Interpreter/OptionGroupFile.cpp index 9bfe8ddf0282..a4b56409698e 100644 --- a/lldb/source/Interpreter/OptionGroupFile.cpp +++ b/lldb/source/Interpreter/OptionGroupFile.cpp @@ -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; } diff --git a/lldb/source/Interpreter/OptionGroupFormat.cpp b/lldb/source/Interpreter/OptionGroupFormat.cpp index 601a78458730..153ffe16cbd4 100644 --- a/lldb/source/Interpreter/OptionGroupFormat.cpp +++ b/lldb/source/Interpreter/OptionGroupFormat.cpp @@ -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); } diff --git a/lldb/source/Interpreter/OptionGroupOutputFile.cpp b/lldb/source/Interpreter/OptionGroupOutputFile.cpp index ec9e166d2f05..75ae380a7bc4 100644 --- a/lldb/source/Interpreter/OptionGroupOutputFile.cpp +++ b/lldb/source/Interpreter/OptionGroupOutputFile.cpp @@ -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: diff --git a/lldb/source/Interpreter/OptionGroupString.cpp b/lldb/source/Interpreter/OptionGroupString.cpp index 9bc1c94d3a5a..e0291b154be2 100644 --- a/lldb/source/Interpreter/OptionGroupString.cpp +++ b/lldb/source/Interpreter/OptionGroupString.cpp @@ -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; } diff --git a/lldb/source/Interpreter/OptionGroupUInt64.cpp b/lldb/source/Interpreter/OptionGroupUInt64.cpp index 440c2a740c26..a922ab255968 100644 --- a/lldb/source/Interpreter/OptionGroupUInt64.cpp +++ b/lldb/source/Interpreter/OptionGroupUInt64.cpp @@ -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; } diff --git a/lldb/source/Interpreter/OptionGroupUUID.cpp b/lldb/source/Interpreter/OptionGroupUUID.cpp index 43f7386c9ca6..609967a83e79 100644 --- a/lldb/source/Interpreter/OptionGroupUUID.cpp +++ b/lldb/source/Interpreter/OptionGroupUUID.cpp @@ -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; diff --git a/lldb/source/Interpreter/OptionValue.cpp b/lldb/source/Interpreter/OptionValue.cpp index 1e4ea23cc075..d8b5e12cd82a 100644 --- a/lldb/source/Interpreter/OptionValue.cpp +++ b/lldb/source/Interpreter/OptionValue.cpp @@ -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) diff --git a/lldb/source/Interpreter/OptionValueArch.cpp b/lldb/source/Interpreter/OptionValueArch.cpp index eae903ce5be4..45b9a9e07d9e 100644 --- a/lldb/source/Interpreter/OptionValueArch.cpp +++ b/lldb/source/Interpreter/OptionValueArch.cpp @@ -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; diff --git a/lldb/source/Interpreter/OptionValueArray.cpp b/lldb/source/Interpreter/OptionValueArray.cpp index 136515602905..aabe457534d6 100644 --- a/lldb/source/Interpreter/OptionValueArray.cpp +++ b/lldb/source/Interpreter/OptionValueArray.cpp @@ -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(); diff --git a/lldb/source/Interpreter/OptionValueBoolean.cpp b/lldb/source/Interpreter/OptionValueBoolean.cpp index 71cc2afb98e1..dae1f4b7a76d 100644 --- a/lldb/source/Interpreter/OptionValueBoolean.cpp +++ b/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 "); 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; diff --git a/lldb/source/Interpreter/OptionValueChar.cpp b/lldb/source/Interpreter/OptionValueChar.cpp index 7a0135314c81..b5ef1d346aea 100644 --- a/lldb/source/Interpreter/OptionValueChar.cpp +++ b/lldb/source/Interpreter/OptionValueChar.cpp @@ -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; diff --git a/lldb/source/Interpreter/OptionValueDictionary.cpp b/lldb/source/Interpreter/OptionValueDictionary.cpp index e5299f8cc390..ddddb5b13696 100644 --- a/lldb/source/Interpreter/OptionValueDictionary.cpp +++ b/lldb/source/Interpreter/OptionValueDictionary.cpp @@ -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; } } diff --git a/lldb/source/Interpreter/OptionValueEnumeration.cpp b/lldb/source/Interpreter/OptionValueEnumeration.cpp index b5cdd81ee2eb..0f163d1c4f74 100644 --- a/lldb/source/Interpreter/OptionValueEnumeration.cpp +++ b/lldb/source/Interpreter/OptionValueEnumeration.cpp @@ -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; diff --git a/lldb/source/Interpreter/OptionValueFileSpec.cpp b/lldb/source/Interpreter/OptionValueFileSpec.cpp index 6538a64627d2..221a5c5f1b2b 100644 --- a/lldb/source/Interpreter/OptionValueFileSpec.cpp +++ b/lldb/source/Interpreter/OptionValueFileSpec.cpp @@ -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; diff --git a/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp b/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp index 0e696ca91db6..669d3ee33acc 100644 --- a/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp +++ b/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp @@ -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; diff --git a/lldb/source/Interpreter/OptionValueFormat.cpp b/lldb/source/Interpreter/OptionValueFormat.cpp index d91f10b0edeb..351790c54d28 100644 --- a/lldb/source/Interpreter/OptionValueFormat.cpp +++ b/lldb/source/Interpreter/OptionValueFormat.cpp @@ -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; diff --git a/lldb/source/Interpreter/OptionValueFormatEntity.cpp b/lldb/source/Interpreter/OptionValueFormatEntity.cpp index fb8c682a03f8..41d29fc4dd35 100644 --- a/lldb/source/Interpreter/OptionValueFormatEntity.cpp +++ b/lldb/source/Interpreter/OptionValueFormatEntity.cpp @@ -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; diff --git a/lldb/source/Interpreter/OptionValuePathMappings.cpp b/lldb/source/Interpreter/OptionValuePathMappings.cpp index b1e714e97073..722d6a144279 100644 --- a/lldb/source/Interpreter/OptionValuePathMappings.cpp +++ b/lldb/source/Interpreter/OptionValuePathMappings.cpp @@ -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; diff --git a/lldb/source/Interpreter/OptionValueProperties.cpp b/lldb/source/Interpreter/OptionValueProperties.cpp index cf7abaa6ac25..e8d870a99cf8 100644 --- a/lldb/source/Interpreter/OptionValueProperties.cpp +++ b/lldb/source/Interpreter/OptionValueProperties.cpp @@ -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; } diff --git a/lldb/source/Interpreter/OptionValueRegex.cpp b/lldb/source/Interpreter/OptionValueRegex.cpp index fab462f0e704..ebe7ae2feb91 100644 --- a/lldb/source/Interpreter/OptionValueRegex.cpp +++ b/lldb/source/Interpreter/OptionValueRegex.cpp @@ -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(); diff --git a/lldb/source/Interpreter/OptionValueSInt64.cpp b/lldb/source/Interpreter/OptionValueSInt64.cpp index d62353d93d43..97cdf10b7c75 100644 --- a/lldb/source/Interpreter/OptionValueSInt64.cpp +++ b/lldb/source/Interpreter/OptionValueSInt64.cpp @@ -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; diff --git a/lldb/source/Interpreter/OptionValueString.cpp b/lldb/source/Interpreter/OptionValueString.cpp index 9012ab178e3c..eb5b259348aa 100644 --- a/lldb/source/Interpreter/OptionValueString.cpp +++ b/lldb/source/Interpreter/OptionValueString.cpp @@ -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; diff --git a/lldb/source/Interpreter/OptionValueUInt64.cpp b/lldb/source/Interpreter/OptionValueUInt64.cpp index dc06cfe93d5c..b414802b963b 100644 --- a/lldb/source/Interpreter/OptionValueUInt64.cpp +++ b/lldb/source/Interpreter/OptionValueUInt64.cpp @@ -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; diff --git a/lldb/source/Interpreter/OptionValueUUID.cpp b/lldb/source/Interpreter/OptionValueUUID.cpp index c228cf6e415e..4235fbfacf8e 100644 --- a/lldb/source/Interpreter/OptionValueUUID.cpp +++ b/lldb/source/Interpreter/OptionValueUUID.cpp @@ -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; diff --git a/lldb/source/Interpreter/Property.cpp b/lldb/source/Interpreter/Property.cpp index ebc18bccbdf0..cde255acef7a 100644 --- a/lldb/source/Interpreter/Property.cpp +++ b/lldb/source/Interpreter/Property.cpp @@ -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();