Introduce Regex::isLiteralERE function.
[oota-llvm.git] / lib / Support / Regex.cpp
index efc8b90a009091a42ff18b0094ba4bce8029e784..dec967e33f5b886abc484c00f3da3ce1d653bc02 100644 (file)
@@ -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;
+}