Update OptionGroup::SetValue to take StringRef.
Then deal with all the fallout.
Differential Revision: https://reviews.llvm.org/D24847
llvm-svn: 282265
diff --git a/lldb/source/Interpreter/OptionValueString.cpp b/lldb/source/Interpreter/OptionValueString.cpp
index d6e05da..e61ead0 100644
--- a/lldb/source/Interpreter/OptionValueString.cpp
+++ b/lldb/source/Interpreter/OptionValueString.cpp
@@ -114,7 +114,7 @@
if (m_options.Test(eOptionEncodeCharacterEscapeSequences)) {
Args::EncodeEscapeSequences(value_str.c_str(), m_current_value);
} else {
- SetCurrentValue(value_str.c_str());
+ SetCurrentValue(value_str);
}
NotifyValueChanged();
break;
@@ -126,16 +126,13 @@
return OptionValueSP(new OptionValueString(*this));
}
-Error OptionValueString::SetCurrentValue(const char *value) {
+Error OptionValueString::SetCurrentValue(llvm::StringRef value) {
if (m_validator) {
- Error error(m_validator(value, m_validator_baton));
+ Error error(m_validator(value.str().c_str(), m_validator_baton));
if (error.Fail())
return error;
}
- if (value && value[0])
- m_current_value.assign(value);
- else
- m_current_value.clear();
+ m_current_value.assign(value);
return Error();
}