[PATCH] D98086: [FileCheck] Fix CHECK-NOT numeric error diagnostics

Joel E. Denny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 5 15:48:59 PST 2021


jdenny created this revision.
jdenny added reviewers: thopre, jhenderson, probinson.
Herald added a subscriber: hiraditya.
jdenny requested review of this revision.
Herald added a project: LLVM.

Without this patch, FileCheck behaves as follows:

  $ cat check
  CHECK-NOT: [[#0x8000000000000000+0x8000000000000000]]
  
  $ FileCheck -vv -dump-input=never check < input
  check:1:54: remark: implicit EOF: expected string found in input
  CHECK-NOT: [[#0x8000000000000000+0x8000000000000000]]
                                                       ^
  <stdin>:2:1: note: found here
  
  ^
  check:1:15: error: unable to substitute variable or numeric expression: overflow error
  CHECK-NOT: [[#0x8000000000000000+0x8000000000000000]]
                ^
  $ echo $?
  0

Notice that the exit status is 0 even though there's an error.
Moreover, FileCheck doesn't print the error diagnostic if either `-vv`
isn't specified or input dumps are enabled (the default).

With this patch, FileCheck always includes the error diagnostic and 
has non-zero exit status for the above example.  It's possible this
change will cause some existing tests to fail, but my assumption is
that they should fail.

This patch also extends input dumps to include similar error
diagnostics.

As in the test added by this patch, this patch worsens an existing
issue with redundant diagnostics.  I'll fix that bug in a subsequent
patch.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98086

Files:
  llvm/include/llvm/FileCheck/FileCheck.h
  llvm/lib/FileCheck/FileCheck.cpp
  llvm/lib/FileCheck/FileCheckImpl.h
  llvm/test/FileCheck/check-not-numeric-error.txt
  llvm/utils/FileCheck/FileCheck.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98086.328673.patch
Type: text/x-patch
Size: 9887 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210305/ca9e6025/attachment.bin>


More information about the llvm-commits mailing list