1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/utils
Joel E. Denny 12285ee434 [FileCheck] Annotate input dump (1/7)
Extend FileCheck to dump its input annotated with FileCheck's
diagnostics: errors, good matches if -v, and additional information if
-vv.  The goal is to make it easier to visualize FileCheck's matching
behavior when debugging.

Each patch in this series implements input annotations for a
particular category of FileCheck diagnostics.  While the first few
patches alone are somewhat useful, the annotations become much more
useful as later patches implement annotations for -v and -vv
diagnostics, which show the matching behavior leading up to the error.

This first patch implements boilerplate plus input annotations for
error diagnostics reporting that no matches were found for a
directive.  These annotations mark the search ranges of the failed
directives.  Instead of using the usual `^~~`, which is used by later
patches for good matches, these annotations use `X~~` so that this
category of errors is visually distinct.

For example:

```
$ FileCheck -dump-input=help
The following description was requested by -dump-input=help to
explain the input annotations printed by -dump-input=always and
-dump-input=fail:

  - L:     labels line number L of the input file
  - T:L    labels the match result for a pattern of type T from line L of
           the check file
  - X~~    marks search range when no match is found
  - colors error

If you are not seeing color above or in input dumps, try: -color

$ FileCheck -v -dump-input=always check1 < input1 |& sed -n '/^Input file/,$p'
Input file: <stdin>
Check file: check1

-dump-input=help describes the format of the following dump.

Full input was:
<<<<<<
        1: ; abc def
        2: ; ghI jkl
next:3     X~~~~~~~~ error: no match found
>>>>>>

$ cat check1
CHECK: abc
CHECK-SAME: def
CHECK-NEXT: ghi
CHECK-SAME: jkl

$ cat input1
; abc def
; ghI jkl
```

Some additional details related to the boilerplate:

* Enabling: The annotated input dump is enabled by `-dump-input`,
  which can also be set via the `FILECHECK_OPTS` environment variable.
  Accepted values are `help`, `always`, `fail`, or `never`.  As shown
  above, `help` describes the format of the dump.  `always` is helpful
  when you want to investigate a successful FileCheck run, perhaps for
  an unexpected pass. `-dump-input-on-failure` and
  `FILECHECK_DUMP_INPUT_ON_FAILURE` remain as a deprecated alias for
  `-dump-input=fail`.

* Diagnostics: The usual diagnostics are not suppressed in this mode
  and are printed first.  For brevity in the example above, I've
  omitted them using a sed command.  Sometimes they're perfectly
  sufficient, and then they make debugging quicker than if you were
  forced to hunt through a dump of long input looking for the error.
  If you think they'll get in the way sometimes, keep in mind that
  it's pretty easy to grep for the start of the input dump, which is
  `<<<`.

* Colored Annotations: The annotated input is colored if colors are
  enabled (enabling colors can be forced using -color).  For example,
  errors are red.  However, as in the above example, colors are not
  vital to reading the annotations.

I don't know how to test color in the output, so any hints here would
be appreciated.

Reviewed By: george.karpenkov, zturner, probinson

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

llvm-svn: 349418
2018-12-18 00:01:39 +00:00
..
benchmark Silence CMP0048 warning in the benchmark utility library 2018-12-14 00:17:12 +00:00
bugpoint
count
crosstool
docker
emacs Add fneg instruction to syntax highlighting lists 2018-11-13 19:50:38 +00:00
FileCheck [FileCheck] Annotate input dump (1/7) 2018-12-18 00:01:39 +00:00
fpcmp
gdb-scripts
git
git-svn git-llvm: Fix incremental population of svn tree. 2018-11-29 16:46:34 +00:00
gn [gn build] Add build files for opt and its dependency Transforms/Couroutines 2018-12-17 02:33:15 +00:00
jedit
kate Add fneg instruction to syntax highlighting lists 2018-11-13 19:50:38 +00:00
KillTheDoctor
lint
lit [test] Split strip-preserve-time.test, and skip atime test on NetBSD 2018-12-05 11:15:46 +00:00
llvm-build
llvm-lit
LLVMVisualizers Fix Visual Studio PointerIntPair visualizer 2018-12-14 18:20:21 +00:00
Misc
not [not] Improve error reporting consistency. 2018-11-09 01:17:22 +00:00
PerfectShuffle
release Revert "Exclude wasm target from Windows packaging due to PR39448" 2018-11-09 22:05:51 +00:00
Reviewing
sanitizers Add a ubsan blacklist entry for libstdc++ 8.0.1. 2018-11-21 23:04:39 +00:00
TableGen [TableGen:AsmWriter] Cope with consecutive tied operands. 2018-12-14 11:39:55 +00:00
Target/ARM
testgen
textmate
unittest [unittests] Do not use llvm::sort in googlemock 2018-09-20 04:27:32 +00:00
UpdateTestChecks [utils] Use operator "in" instead of bound function "has_key" 2018-12-07 09:49:21 +00:00
valgrind
vim Add fneg instruction to syntax highlighting lists 2018-11-13 19:50:38 +00:00
vscode
yaml-bench
abtest.py
bisect
bisect-skip-count Document bisect-skip-count 2018-10-22 14:04:13 +00:00
bugpoint_gisel_reducer.py
check-each-file
clang-parse-diagnostics-file
codegen-diff
collect_and_build_with_pgo.py [utils] collect_and_build_with_pgo.py: revert part already fixed in rL345461 2018-10-27 23:10:09 +00:00
countloc.sh
create_ladder_graph.py
demangle_tree.py
DSAclean.py
DSAextract.py
extract_symbols.py
extract_vplan.py [VPlan] Script to extract VPlan digraphs from log 2018-10-16 09:37:52 +00:00
findmisopt
findoptdiff
findsym.pl
GenLibDeps.pl
GetRepositoryPath
GetSourceVersion
getsrcs.sh
indirect_calls.py
lldbDataFormatters.py [utils] Update SmallVector lldb formatter for r337514 2018-11-06 18:52:30 +00:00
llvm-compilers-check
llvm-gisel-cov.py
llvm-native-gxx
llvm.grm
LLVMBuild.txt
llvmdo
llvmgrep
prepare-code-coverage-artifact.py [Coverage] Apply filtered paths to summary 2018-10-11 04:00:51 +00:00
schedcover.py
shuffle_fuzz.py
shuffle_select_fuzz_tester.py
sort_includes.py
unicode-case-fold.py
update_analyze_test_checks.py
update_cc_test_checks.py
update_llc_test_checks.py
update_mca_test_checks.py [llvm-mca][UpdateTestChecks] Don't try to align blocks that have already been subject to alignment in update_mca_test_checks.py 2018-10-29 13:24:20 +00:00
update_mir_test_checks.py
update_test_checks.py
UpdateCMakeLists.pl
wciia.py