summaryrefslogtreecommitdiff
path: root/source/Interpreter/OptionValueRegex.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-10-23 17:53:01 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-10-23 17:53:01 +0000
commitead246455adf1a215ec2715dad6533073a6beb4e (patch)
treef3f97a47d77053bf96fe74cdbd6fae74380e8a92 /source/Interpreter/OptionValueRegex.cpp
parentfdb00c4408990a0a63ef7f496d809ce59f263bc5 (diff)
Notes
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;
}