[llvm-commits] [llvm] r125193 - /llvm/trunk/utils/FileCheck/FileCheck.cpp

Chris Lattner sabre at nondot.org
Wed Feb 9 08:46:03 PST 2011


Author: lattner
Date: Wed Feb  9 10:46:02 2011
New Revision: 125193

URL: http://llvm.org/viewvc/llvm-project?rev=125193&view=rev
Log:
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.

Modified:
    llvm/trunk/utils/FileCheck/FileCheck.cpp

Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/FileCheck/FileCheck.cpp?rev=125193&r1=125192&r2=125193&view=diff
==============================================================================
--- llvm/trunk/utils/FileCheck/FileCheck.cpp (original)
+++ llvm/trunk/utils/FileCheck/FileCheck.cpp Wed Feb  9 10:46:02 2011
@@ -659,6 +659,11 @@
   }
   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);





More information about the llvm-commits mailing list