summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Regex.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2013-08-05 17:47:59 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2013-08-05 17:47:59 +0000
commitfe8cd7597142cc0533411b81dd82cd8ef48ed716 (patch)
treec994783609d667944d15228265890d80bc2f4769 /llvm/lib/Support/Regex.cpp
parentbd6389b11fd936698e90083fc85cbf837774b29c (diff)
downloadbcm5719-llvm-fe8cd7597142cc0533411b81dd82cd8ef48ed716.tar.gz
bcm5719-llvm-fe8cd7597142cc0533411b81dd82cd8ef48ed716.zip
Introduce Regex::isLiteralERE function.
This will be used to implement an optimisation for literal entries in special case lists. Differential Revision: http://llvm-reviews.chandlerc.com/D1278 llvm-svn: 187731
Diffstat (limited to 'llvm/lib/Support/Regex.cpp')
-rw-r--r--llvm/lib/Support/Regex.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Support/Regex.cpp b/llvm/lib/Support/Regex.cpp
index efc8b90a009..dec967e33f5 100644
--- a/llvm/lib/Support/Regex.cpp
+++ b/llvm/lib/Support/Regex.cpp
@@ -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