diff options
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Interpreter/OptionValueArray.cpp')
-rw-r--r-- | contrib/llvm/tools/lldb/source/Interpreter/OptionValueArray.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueArray.cpp b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueArray.cpp index c0d48c1..aabe457 100644 --- a/contrib/llvm/tools/lldb/source/Interpreter/OptionValueArray.cpp +++ b/contrib/llvm/tools/lldb/source/Interpreter/OptionValueArray.cpp @@ -14,6 +14,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Core/Stream.h" +#include "lldb/Host/StringConvert.h" #include "lldb/Interpreter/Args.h" using namespace lldb; @@ -73,11 +74,13 @@ 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); - NotifyValueChanged(); - return SetArgs (args, op); + Args args(value.str().c_str()); + Error error = SetArgs (args, op); + if (error.Success()) + NotifyValueChanged(); + return error; } @@ -97,7 +100,7 @@ OptionValueArray::GetSubValue (const ExecutionContext *exe_ctx, sub_value = end_bracket + 1; std::string index_str (name+1, end_bracket); const size_t array_count = m_values.size(); - int32_t idx = Args::StringToSInt32(index_str.c_str(), INT32_MAX, 0, nullptr); + int32_t idx = StringConvert::ToSInt32(index_str.c_str(), INT32_MAX, 0, nullptr); if (idx != INT32_MAX) { ; @@ -177,7 +180,7 @@ OptionValueArray::SetArgs (const Args &args, VarSetOperationType op) case eVarSetOperationInsertAfter: if (argc > 1) { - uint32_t idx = Args::StringToUInt32(args.GetArgumentAtIndex(0), UINT32_MAX); + uint32_t idx = StringConvert::ToUInt32(args.GetArgumentAtIndex(0), UINT32_MAX); const uint32_t count = GetSize(); if (idx > count) { @@ -225,7 +228,7 @@ OptionValueArray::SetArgs (const Args &args, VarSetOperationType op) for (i=0; i<argc; ++i) { const size_t idx = - Args::StringToSInt32(args.GetArgumentAtIndex(i), INT32_MAX); + StringConvert::ToSInt32(args.GetArgumentAtIndex(i), INT32_MAX); if (idx >= size) { all_indexes_valid = false; @@ -274,7 +277,7 @@ OptionValueArray::SetArgs (const Args &args, VarSetOperationType op) case eVarSetOperationReplace: if (argc > 1) { - uint32_t idx = Args::StringToUInt32(args.GetArgumentAtIndex(0), UINT32_MAX); + uint32_t idx = StringConvert::ToUInt32(args.GetArgumentAtIndex(0), UINT32_MAX); const uint32_t count = GetSize(); if (idx > count) { @@ -341,6 +344,8 @@ OptionValueArray::DeepCopy () const { OptionValueArray *copied_array = new OptionValueArray (m_type_mask, m_raw_value_dump); lldb::OptionValueSP copied_value_sp(copied_array); + *static_cast<OptionValue *>(copied_array) = *this; + copied_array->m_callback = m_callback; const uint32_t size = m_values.size(); for (uint32_t i = 0; i<size; ++i) { |