[PATCH] D73793: Improve error message of FileCheck when stdin is empty
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 4 03:21:16 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6e01cd6795f8: Improve error message of FileCheck when stdin is empty (authored by David Bozier <daveb at graphcore.ai>).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73793/new/
https://reviews.llvm.org/D73793
Files:
llvm/test/FileCheck/check-empty.txt
llvm/utils/FileCheck/FileCheck.cpp
Index: llvm/utils/FileCheck/FileCheck.cpp
===================================================================
--- llvm/utils/FileCheck/FileCheck.cpp
+++ llvm/utils/FileCheck/FileCheck.cpp
@@ -616,6 +616,8 @@
// Open the file to check and add it to SourceMgr.
ErrorOr<std::unique_ptr<MemoryBuffer>> InputFileOrErr =
MemoryBuffer::getFileOrSTDIN(InputFilename);
+ if (InputFilename == "-")
+ InputFilename = "<stdin>"; // Overwrite for improved diagnostic messages
if (std::error_code EC = InputFileOrErr.getError()) {
errs() << "Could not open input file '" << InputFilename
<< "': " << EC.message() << '\n';
@@ -648,7 +650,7 @@
(ExitCode == 1 && DumpInput == DumpInputFail)) {
errs() << "\n"
<< "Input file: "
- << (InputFilename == "-" ? "<stdin>" : InputFilename.getValue())
+ << InputFilename
<< "\n"
<< "Check file: " << CheckFilename << "\n"
<< "\n"
Index: llvm/test/FileCheck/check-empty.txt
===================================================================
--- llvm/test/FileCheck/check-empty.txt
+++ llvm/test/FileCheck/check-empty.txt
@@ -17,7 +17,7 @@
; FOO: foo
; NOFOO-NOT: foo
-; EMPTY-ERR: FileCheck error: '-' is empty.
+; EMPTY-ERR: FileCheck error: '<stdin>' is empty.
; EMPTY-ERR-NEXT: FileCheck command line: {{.*}}{{F|f}}ile{{C|c}}heck{{.*}}-check-prefix={{.*}}FOO {{.*}}check-empty.txt
-; NO-EMPTY-ERR-NOT: FileCheck error: '-' is empty.
+; NO-EMPTY-ERR-NOT: FileCheck error: '<stdin>' is empty.
; NOT-FOUND: error: FOO: expected string not found in input
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73793.242278.patch
Type: text/x-patch
Size: 1602 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200204/b0967c20/attachment.bin>
More information about the llvm-commits
mailing list