[all-commits] [llvm/llvm-project] dd59c1: [FileCheck] Fix numeric error propagation
Joel E. Denny via All-commits
all-commits at lists.llvm.org
Wed Mar 17 16:27:41 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: dd59c1324df6d9d3720561c1a4af58af2e8ebc5a
https://github.com/llvm/llvm-project/commit/dd59c1324df6d9d3720561c1a4af58af2e8ebc5a
Author: Joel E. Denny <jdenny.ornl at gmail.com>
Date: 2021-03-17 (Wed, 17 Mar 2021)
Changed paths:
M llvm/include/llvm/FileCheck/FileCheck.h
M llvm/lib/FileCheck/FileCheck.cpp
M llvm/lib/FileCheck/FileCheckImpl.h
A llvm/test/FileCheck/match-time-error-propagation/invalid-excluded-pattern.txt
A llvm/test/FileCheck/match-time-error-propagation/invalid-expected-pattern.txt
A llvm/test/FileCheck/match-time-error-propagation/matched-excluded-pattern.txt
A llvm/test/FileCheck/match-time-error-propagation/matched-expected-pattern.txt
M llvm/unittests/FileCheck/FileCheckTest.cpp
M llvm/utils/FileCheck/FileCheck.cpp
Log Message:
-----------
[FileCheck] Fix numeric error propagation
A more general name might be match-time error propagation. That is,
it's conceivable we'll one day have non-numeric errors that require
the handling fixed by this patch.
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 unless both
`-dump-input=never` and `-vv` are specified.
The same problem occurs when `CHECK-NOT` does have a match but a
capture fails due to overflow: exit status is 0, and no diagnostic is
printed unless both `-dump-input=never` and `-vv` are specified. The
usefulness of capturing from `CHECK-NOT` is questionable, but this
case should certainly produce an error.
With this patch, FileCheck always includes the error diagnostic and
has non-zero exit status for the above examples. It's conceivable
that this change will cause some existing tests to fail, but my
assumption is that they should fail. Moreover, with nearly every
project enabled, this patch didn't produce additional `check-all`
failures for me.
This patch also extends input dumps to include such numeric error
diagnostics for both expected and excluded patterns.
As noted in fixmes in some of the tests added by this patch, this
patch worsens an existing issue with redundant diagnostics. I'll fix
that bug in a subsequent patch.
Reviewed By: thopre, jhenderson
Differential Revision: https://reviews.llvm.org/D98086
Commit: f87b4109b26732acfc382ed359c0766cfb15ed2a
https://github.com/llvm/llvm-project/commit/f87b4109b26732acfc382ed359c0766cfb15ed2a
Author: Joel E. Denny <jdenny.ornl at gmail.com>
Date: 2021-03-17 (Wed, 17 Mar 2021)
Changed paths:
M llvm/lib/FileCheck/FileCheck.cpp
M llvm/test/FileCheck/match-time-error-propagation/invalid-excluded-pattern.txt
M llvm/test/FileCheck/match-time-error-propagation/invalid-expected-pattern.txt
Log Message:
-----------
[FileCheck] Fix redundant diagnostics due to numeric errors
Fixed substitution printing not to produce an empty diagnostic for
errors handled elsewhere.
Reviewed By: thopre
Differential Revision: https://reviews.llvm.org/D98088
Compare: https://github.com/llvm/llvm-project/compare/a875721d8a2d...f87b4109b267
More information about the All-commits
mailing list