[PATCH] D77607: [FileCheck] Fix --dump-input annotation sort per input line

Joel E. Denny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 6 16:55:11 PDT 2020


jdenny created this revision.
jdenny added reviewers: probinson, thopre.
Herald added a project: LLVM.
jdenny added a parent revision: D77605: [FileCheck] Fix --dump-input implicit pattern location.

Without this patch, `--dump-input` annotations on a single input line
are sorted by the associated directive's check-file line.  That seemed
fine because that's often identical to the order in which FileCheck
looks for matches for those directives.

The first problem is that an `--implicit-check-not` pattern has no
check-file line.  The logical equivalent is sorting in command-line
order, but that's not implemented.

The second problem is that, unlike a directive, an
`--implicit-check-not` pattern applies at many points, between many
different pairs of directives.  However, sorting in command-line order
gathers all its associated diagnostics together at one point in an
input line's list of annotations.

In general, it seems to be easier to understand FileCheck's logic when
annotations on a single input line are sorted in the order FileCheck
produced the associated diagnostics, so this patch makes that change.
As documented in the patch, the annotation sort order is also
especially relevant to `CHECK-LABEL`, `CHECK-NOT`, and `CHECK-DAG`, so
this patch updates or extends tests to check the sort makes sense for 
them.  (However, the sort for `CHECK-DAG` annotations should not 
actually be altered by this patch.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77607

Files:
  llvm/test/FileCheck/dump-input-annotations.txt
  llvm/utils/FileCheck/FileCheck.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77607.255533.patch
Type: text/x-patch
Size: 12469 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200406/44336521/attachment.bin>


More information about the llvm-commits mailing list