[all-commits] [llvm/llvm-project] b5a246: [FileCheck] Fix --dump-input implicit pattern loca...

Joel E. Denny via All-commits all-commits at lists.llvm.org
Thu Apr 16 12:41:04 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b5a24610fad6d68f65bd6ec8db52b6e480c56d6c
      https://github.com/llvm/llvm-project/commit/b5a24610fad6d68f65bd6ec8db52b6e480c56d6c
  Author: Joel E. Denny <jdenny.ornl at gmail.com>
  Date:   2020-04-16 (Thu, 16 Apr 2020)

  Changed paths:
    M llvm/include/llvm/Support/FileCheck.h
    M llvm/lib/Support/FileCheck.cpp
    M llvm/test/FileCheck/dump-input-annotations.txt
    M llvm/utils/FileCheck/FileCheck.cpp

  Log Message:
  -----------
  [FileCheck] Fix --dump-input implicit pattern location

Currently, `--dump-input` implies that all `--implicit-check-not`
patterns appear on line 1 by printing annotations like:

```
       1: foo bar baz
not:1         !~~     error: no match expected
```

This patch changes that to:

```
          1: foo bar baz
not:imp1         !~~     error: no match expected
```

`imp1` indicates the first `--implicit-check-not` pattern.

Reviewed By: thopre

Differential Revision: https://reviews.llvm.org/D77605


  Commit: ce685455e4500f9f4a6686b1667a132d2c8a3c12
      https://github.com/llvm/llvm-project/commit/ce685455e4500f9f4a6686b1667a132d2c8a3c12
  Author: Joel E. Denny <jdenny.ornl at gmail.com>
  Date:   2020-04-16 (Thu, 16 Apr 2020)

  Changed paths:
    M llvm/test/FileCheck/dump-input-annotations.txt
    M llvm/utils/FileCheck/FileCheck.cpp

  Log Message:
  -----------
  [FileCheck] Fix --dump-input annotation sort per input line

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.)

Reviewed By: thopre

Differential Revision: https://reviews.llvm.org/D77607


Compare: https://github.com/llvm/llvm-project/compare/86478d3de91a...ce685455e450


More information about the All-commits mailing list