summaryrefslogtreecommitdiffstats
path: root/llvm/utils
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-04-09 06:37:03 +0000
committerChris Lattner <sabre@nondot.org>2011-04-09 06:37:03 +0000
commite53c95f180eba8c8c656fa67ccd15cb10334844c (patch)
tree47610cdff74410c20d631e380919e13e72bbbc77 /llvm/utils
parent418b1037b0ac8973b3b6d4c4a534eda1cc86898a (diff)
downloadbcm5719-llvm-e53c95f180eba8c8c656fa67ccd15cb10334844c.tar.gz
bcm5719-llvm-e53c95f180eba8c8c656fa67ccd15cb10334844c.zip
fix PR9629 - We were lowering regexes like a{{b|c}}d into ab|cd, which
is substantially different than a(b|c)d. Form the latter regex instead. This found a few problems in the testsuite, which serves as its test. llvm-svn: 129196
Diffstat (limited to 'llvm/utils')
-rw-r--r--llvm/utils/FileCheck/FileCheck.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/utils/FileCheck/FileCheck.cpp b/llvm/utils/FileCheck/FileCheck.cpp
index 58001b73ab6..f2255948658 100644
--- a/llvm/utils/FileCheck/FileCheck.cpp
+++ b/llvm/utils/FileCheck/FileCheck.cpp
@@ -148,8 +148,16 @@ bool Pattern::ParsePattern(StringRef PatternStr, SourceMgr &SM) {
return true;
}
+ // Enclose {{}} patterns in parens just like [[]] even though we're not
+ // capturing the result for any purpose. This is required in case the
+ // expression contains an alternation like: CHECK: abc{{x|z}}def. We
+ // want this to turn into: "abc(x|z)def" not "abcx|zdef".
+ RegExStr += '(';
+ ++CurParen;
+
if (AddRegExToRegEx(PatternStr.substr(2, End-2), CurParen, SM))
return true;
+ RegExStr += ')';
PatternStr = PatternStr.substr(End+2);
continue;
OpenPOWER on IntegriCloud