summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/lib/Support/Regex.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/lib/Support/Regex.cpp')
-rw-r--r--contrib/llvm/lib/Support/Regex.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/contrib/llvm/lib/Support/Regex.cpp b/contrib/llvm/lib/Support/Regex.cpp
index efc8b90..5413641 100644
--- a/contrib/llvm/lib/Support/Regex.cpp
+++ b/contrib/llvm/lib/Support/Regex.cpp
@@ -43,7 +43,7 @@ bool Regex::isValid(std::string &Error) {
size_t len = llvm_regerror(error, preg, NULL, 0);
- Error.resize(len);
+ Error.resize(len - 1);
llvm_regerror(error, preg, &Error[0], len);
return false;
}
@@ -168,3 +168,10 @@ std::string Regex::sub(StringRef Repl, StringRef String,
return Res;
}
+
+bool Regex::isLiteralERE(StringRef Str) {
+ // Check for regex metacharacters. This list was derived from our regex
+ // implementation in regcomp.c and double checked against the POSIX extended
+ // regular expression specification.
+ return Str.find_first_of("()^$|*+?.[]\\{}") == StringRef::npos;
+}
OpenPOWER on IntegriCloud