HomePhabricator

[FileCheck] Implement -dump-input-context

Authored by jdenny on Jul 10 2020, 4:50 AM.

Description

[FileCheck] Implement -dump-input-context

This patch is motivated by discussions at each of:

When input is dumped as specified by -dump-input=fail, this patch
filters the dump to show only input lines that are the starting lines
of error diagnostics plus the number of contextual lines specified
-dump-input-context (defaults to 5).

When -dump-input=always, there might be not be any errors, so all
input lines are printed, as without this patch.

Here's some sample output with -dump-input-context=3 -vv:

<<<<<<
           .
           .
           .
          13: foo
          14: foo
          15: hello world
check:1       ^~~~~~~~~~~
          16: foo
check:2'0     X~~ error: no match found
          17: foo
check:2'0     ~~~
          18: foo
check:2'0     ~~~
          19: foo
check:2'0     ~~~
           .
           .
           .
          27: foo
check:2'0     ~~~
          28: foo
check:2'0     ~~~
          29: foo
check:2'0     ~~~
          30: goodbye word
check:2'0     ~~~~~~~~~~~~
check:2'1     ?            possible intended match
          31: foo
check:2'0     ~~~
          32: foo
check:2'0     ~~~
          33: foo
check:2'0     ~~~
           .
           .
           .
>>>>>>

Reviewed By: mehdi_amini, arsenm, jhenderson, rsmith, SjoerdMeijer, Meinersbur, lattner

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

Details

Committed
jdennyJul 10 2020, 8:02 AM
Reviewer
mehdi_amini
Differential Revision
D82203: [FileCheck] Implement -dump-input-context
Parents
rG23cd70d71c10: [PDB] Fix out-of-bounds acces when sorting GSI buckets
Branches
Unknown
Tags
Unknown