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
This commit is contained in:
Chris Lattner 2011-04-09 06:37:03 +00:00
parent 418b1037b0
commit e53c95f180
1 changed files with 8 additions and 0 deletions

View File

@ -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;