diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2013-08-05 17:47:59 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2013-08-05 17:47:59 +0000 |
commit | aa80e61b0d79ddf9593f6217063574d0c66c3099 (patch) | |
tree | b67392ed36975afce5e1c12553d94b9274dc9321 /lib/Support/Regex.cpp | |
parent | 2a37c7e9e6059f7b5cfffce8917a49c0810d5a18 (diff) | |
download | llvm-aa80e61b0d79ddf9593f6217063574d0c66c3099.tar.gz llvm-aa80e61b0d79ddf9593f6217063574d0c66c3099.tar.bz2 llvm-aa80e61b0d79ddf9593f6217063574d0c66c3099.tar.xz |
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187731 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Regex.cpp')
-rw-r--r-- | lib/Support/Regex.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Support/Regex.cpp b/lib/Support/Regex.cpp index efc8b90a00..dec967e33f 100644 --- a/lib/Support/Regex.cpp +++ b/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; +} |