This is an archive of the discontinued LLVM Phabricator instance.

FileCheck Enhancement - repeats in regular expressions
Needs RevisionPublic

Authored by eklepilkina on Jul 18 2016, 1:22 AM.

Details

Summary

Repeat with current number should become available by using {n}, {n,m} , {,n}, {n,}

Diff Detail

Event Timeline

eklepilkina retitled this revision from to FileCheck Enhancement - repeats in regular expressions.
eklepilkina updated this object.
eklepilkina changed the edit policy from "All Users" to "Administrators".
eklepilkina added subscribers: aprantl, llvm-commits.
eklepilkina edited reviewers, added: alexfh; removed: dblaikie.Sep 19 2016, 1:41 AM
alexfh requested changes to this revision.Sep 23 2016, 5:54 PM
alexfh edited edge metadata.
alexfh added inline comments.
docs/CommandGuide/FileCheck.rst
485

Seems like this doesn't need a separate mention in the FileCheck documentation: it's just a feature of the regular expressions, and it should just work.

test/FileCheck/repeat-in-regex.txt
1

Will {{ˆ}}} still match a closing curly brace at the start of line? In general, there are tests that use }}} in the CHECK lines, and the change in how this sequence is parsed can affect them. Have you tried to run all LLVM and Clang tests with this change?

utils/FileCheck/FileCheck.cpp
242

How about a bit more self-documenting version?

StringRef::size_type LastBrace = PatternStr.find_first_not_of('}', EndChar);
if (LastBrace != StringRef::npos)
  EndChar = LastBrace - 1;
This revision now requires changes to proceed.Sep 23 2016, 5:54 PM
eklepilkina added inline comments.Sep 25 2016, 11:50 PM
docs/CommandGuide/FileCheck.rst
485

I added, because this feature doesn't work before. I think that description in documantation isn't extra. I agree that it may be replaced.

test/FileCheck/repeat-in-regex.txt
1

Yes, I did. I ran all LLVM and Clang tests with this patch.

utils/FileCheck/FileCheck.cpp
242

But if there is npos, then there won't be any shift even if last characters are }}} and End will be smaller then it should be.