Make lldb::Regex use StringRef.
This updates getters and setters to use StringRef instead of
const char *. I tested the build on Linux, Windows, and OSX
and saw no build or test failures. I cannot test any BSD
or Android variants, however I expect the required changes
to be minimal or non-existant.
llvm-svn: 282079
diff --git a/lldb/source/Interpreter/OptionValueRegex.cpp b/lldb/source/Interpreter/OptionValueRegex.cpp
index 9a19b84..86ef102 100644
--- a/lldb/source/Interpreter/OptionValueRegex.cpp
+++ b/lldb/source/Interpreter/OptionValueRegex.cpp
@@ -26,10 +26,8 @@
if (dump_mask & eDumpOptionType)
strm.PutCString(" = ");
if (m_regex.IsValid()) {
- const char *regex_text = m_regex.GetText();
- if (regex_text && regex_text[0])
- strm.Printf("%s", regex_text);
- } else {
+ llvm::StringRef regex_text = m_regex.GetText();
+ strm.Printf("%s", regex_text.str().c_str());
}
}
}
@@ -53,7 +51,7 @@
case eVarSetOperationReplace:
case eVarSetOperationAssign:
- if (m_regex.Compile(value.str().c_str())) {
+ if (m_regex.Compile(value)) {
m_value_was_set = true;
NotifyValueChanged();
} else {
@@ -70,5 +68,5 @@
}
lldb::OptionValueSP OptionValueRegex::DeepCopy() const {
- return OptionValueSP(new OptionValueRegex(m_regex.GetText()));
+ return OptionValueSP(new OptionValueRegex(m_regex.GetText().str().c_str()));
}