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
This commit is contained in:
Chris Lattner 2011-02-09 16:46:02 +00:00
parent 66298c104e
commit 1aac1864cf

View File

@ -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);