summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-02-09 16:46:02 +0000
committerChris Lattner <sabre@nondot.org>2011-02-09 16:46:02 +0000
commitb692bed732d88989cabb6690c8014d59ce67d8ac (patch)
tree26682e71ce86d61496cdaad01176c82e5d89d0ae
parentf10dfdc77a02fea77ea2fd8d34cd32218c1737c1 (diff)
downloadbcm5719-llvm-b692bed732d88989cabb6690c8014d59ce67d8ac.tar.gz
bcm5719-llvm-b692bed732d88989cabb6690c8014d59ce67d8ac.zip
emit a specific error when the input file is empty. This fixes
an annoyance of mine when working on tests: if the input .ll file is broken, opt outputs an error and generates an empty file. FileCheck then emits its "ooh I couldn't find the first CHECK line, scanning from ..." which obfuscates the actual problem. llvm-svn: 125193
-rw-r--r--llvm/utils/FileCheck/FileCheck.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/utils/FileCheck/FileCheck.cpp b/llvm/utils/FileCheck/FileCheck.cpp
index a4aa693448b..5d4cb0c0c5f 100644
--- a/llvm/utils/FileCheck/FileCheck.cpp
+++ b/llvm/utils/FileCheck/FileCheck.cpp
@@ -659,6 +659,11 @@ int main(int argc, char **argv) {
}
MemoryBuffer *F = File.take();
+ if (F->getBufferSize() == 0) {
+ errs() << "FileCheck error: '" << InputFilename << "' is empty.\n";
+ return 1;
+ }
+
// Remove duplicate spaces in the input file if requested.
if (!NoCanonicalizeWhiteSpace)
F = CanonicalizeInputFile(F);
OpenPOWER on IntegriCloud