aboutsummaryrefslogtreecommitdiffstats
path: root/source/Interpreter/OptionValueRegex.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Interpreter/OptionValueRegex.cpp')
-rw-r--r--source/Interpreter/OptionValueRegex.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/source/Interpreter/OptionValueRegex.cpp b/source/Interpreter/OptionValueRegex.cpp
index bbe3fa715019..cf806fb550f9 100644
--- a/source/Interpreter/OptionValueRegex.cpp
+++ b/source/Interpreter/OptionValueRegex.cpp
@@ -46,16 +46,14 @@ Status OptionValueRegex::SetValueFromString(llvm::StringRef value,
case eVarSetOperationReplace:
case eVarSetOperationAssign:
- if (m_regex.Compile(value)) {
+ m_regex = RegularExpression(value);
+ if (m_regex.IsValid()) {
m_value_was_set = true;
NotifyValueChanged();
+ } else if (llvm::Error err = m_regex.GetError()) {
+ error.SetErrorString(llvm::toString(std::move(err)));
} else {
- char regex_error[1024];
- if (m_regex.GetErrorAsCString(regex_error, sizeof(regex_error)))
- error.SetErrorString(regex_error);
- else
- error.SetErrorStringWithFormat("regex error %u",
- m_regex.GetErrorCode());
+ error.SetErrorString("regex error");
}
break;
}