summaryrefslogtreecommitdiff
path: root/utils/FileCheck
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2012-09-07 06:47:16 +0000
committerTed Kremenek <kremenek@apple.com>2012-09-07 06:47:16 +0000
commit2e578388ab8b0f6070ad95bae584423931a98c78 (patch)
tree9e401d7b5ae25f2887e3287e3620370448657c24 /utils/FileCheck
parent1fdaee9995f1bf1553cecd4da62daba91fd4fa1f (diff)
downloadllvm-2e578388ab8b0f6070ad95bae584423931a98c78.tar.gz
llvm-2e578388ab8b0f6070ad95bae584423931a98c78.tar.bz2
llvm-2e578388ab8b0f6070ad95bae584423931a98c78.tar.xz
Add -exact-match option to FileCheck to allow clients to do exact matches without using regular expressions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163371 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/FileCheck')
-rw-r--r--utils/FileCheck/FileCheck.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/utils/FileCheck/FileCheck.cpp b/utils/FileCheck/FileCheck.cpp
index 33f04ce647..0805504ad1 100644
--- a/utils/FileCheck/FileCheck.cpp
+++ b/utils/FileCheck/FileCheck.cpp
@@ -45,6 +45,10 @@ static cl::opt<bool>
NoCanonicalizeWhiteSpace("strict-whitespace",
cl::desc("Do not treat all horizontal whitespace as equivalent"));
+static cl::opt<bool>
+NoRegex("exact-match",
+ cl::desc("Look for exact matches without using regular expressions"));
+
//===----------------------------------------------------------------------===//
// Pattern Handling Code.
//===----------------------------------------------------------------------===//
@@ -124,7 +128,7 @@ bool Pattern::ParsePattern(StringRef PatternStr, SourceMgr &SM) {
}
// Check to see if this is a fixed string, or if it has regex pieces.
- if (PatternStr.size() < 2 ||
+ if (PatternStr.size() < 2 || NoRegex ||
(PatternStr.find("{{") == StringRef::npos &&
PatternStr.find("[[") == StringRef::npos)) {
FixedStr = PatternStr;