[PATCH] D60392: FileCheck [12/12]: Support use of var defined on same line

Thomas Preud'homme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 7 16:25:33 PDT 2019


thopre created this revision.
thopre added reviewers: jhenderson, chandlerc, jdenny, probinson, grimar, arichardson, rnk.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
thopre added a parent revision: D60391: FileCheck [11/12]: Add matching constraint specification.

This patch is part of a patch series to add support for FileCheck
numeric expressions. This specific patch adds support for using a
numeric variable with empty numeric expression defined on the same line
either directly or indirectly.

The regex language used to represent a constraint corresponding to a
given CHECK directive does not allow to express a numeric relation. It
is therefore necessary to initially match any number in the appropriate
matching format and check the constraints are verified in a follow-up
step. Such a process must then be repeated as long as the constraints
fail because of cases with a check directive like #N: #N+1
where the input contains lines such as:
10 12
10 11

The first line would match the regex "[0-9]+ [0-9]+" generated for the
CHECK directive but the constraint would fail. The second line would
then need to be tried since it both matches successfully and verifies
the constraints of the CHECK directive. Note that this process would
still fail to match if the input was:
10 12 13
because the regex would match 10 and 12 which fail to verify the
constraints and the process would then skip to the next line since there
is no way to ask the regex engine if the line had other possible
matches. This caveat is documented.

Copyright:

- Linaro (changes up to diff 183612 of revision D55940 <https://reviews.llvm.org/D55940>)
- GraphCore (changes in later versions of revision D55940 <https://reviews.llvm.org/D55940> and in new revision created off D55940 <https://reviews.llvm.org/D55940>)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D60392

Files:
  llvm/docs/CommandGuide/FileCheck.rst
  llvm/include/llvm/Support/FileCheck.h
  llvm/lib/Support/FileCheck.cpp
  llvm/test/FileCheck/numeric-expression.txt
  llvm/test/FileCheck/verbose.txt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60392.194087.patch
Type: text/x-patch
Size: 35976 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190407/f49e02e2/attachment.bin>


More information about the llvm-commits mailing list