[PATCH] D83650: [FileCheck] Extend -dump-input with substitutions

Joel E. Denny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 12 18:45:04 PDT 2020


jdenny created this revision.
jdenny added reviewers: probinson, thopre, jhenderson, mehdi_amini.
Herald added subscribers: llvm-commits, hiraditya, arichardson.
Herald added a project: LLVM.

Substitutions are already reported in the diagnostics appearing before
the input dump in the case of failed directives, and they're reported
in traces (produced by `-vv -dump-input=never`) in the case of
successful directives.  However, those reports are not always
convenient to view while investigating the input dump, so this patch
adds the substitution report to the input dump too.  For example:

  $ cat check
  CHECK: hello [[WHAT:[a-z]+]]
  CHECK: [[VERB]] [[WHAT]]
  
  $ FileCheck -vv -DVERB=goodbye check < input |& tail -8
  <<<<<<
             1: hello world
  check:1       ^~~~~~~~~~~
             2: goodbye word
  check:2'0     X~~~~~~~~~~~ error: no match found
  check:2'1                  with "VERB" equal to "goodbye"
  check:2'2                  with "WHAT" equal to "world"
  >>>>>>

Without this patch, the location reported for a substitution for a
directive match is the directive's full match range.  This location is
misleading as it implies the substitution itself matches that range.
This patch changes the reported location to just the match range start
to suggest the substitution is known at the start of the match.  (As 
in the above example, input dumps don't mark any range for 
substitutions.  The location info in that case simply identifies the 
right line for the annotation.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83650

Files:
  llvm/include/llvm/Support/FileCheck.h
  llvm/lib/Support/FileCheck.cpp
  llvm/lib/Support/FileCheckImpl.h
  llvm/test/FileCheck/dump-input-annotations.txt
  llvm/test/FileCheck/verbose.txt
  llvm/utils/FileCheck/FileCheck.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83650.277311.patch
Type: text/x-patch
Size: 16465 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200713/c9a73701/attachment.bin>


More information about the llvm-commits mailing list