diff options
author | Chris Lattner <sabre@nondot.org> | 2011-02-09 16:46:02 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-02-09 16:46:02 +0000 |
commit | 1aac1864cfb66ae3d322ff7e28738d03bc1d1bfc (patch) | |
tree | de1d23d2c2adca085340ee34c4041b3eff8b2b49 /utils/FileCheck | |
parent | 66298c104e9562c414f106d2fb0415218ec5c5d6 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125193 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/FileCheck')
-rw-r--r-- | utils/FileCheck/FileCheck.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/utils/FileCheck/FileCheck.cpp b/utils/FileCheck/FileCheck.cpp index a4aa693448..5d4cb0c0c5 100644 --- a/utils/FileCheck/FileCheck.cpp +++ b/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); |