Refactor OptionValue::SetValueFromCString to use llvm::StringRef
Reviewers: clayborg
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D7676
llvm-svn: 230005
diff --git a/lldb/source/Interpreter/OptionValueDictionary.cpp b/lldb/source/Interpreter/OptionValueDictionary.cpp
index e5299f8..ddddb5b 100644
--- a/lldb/source/Interpreter/OptionValueDictionary.cpp
+++ b/lldb/source/Interpreter/OptionValueDictionary.cpp
@@ -211,16 +211,16 @@
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 @@
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 @@
return false;
if (pos->second->GetType() == OptionValue::eTypeString)
{
- pos->second->SetValueFromCString(value);
+ pos->second->SetValueFromString(value);
return true;
}
}