[llvm] r271047 - FileCheck: dump command line context with empty input

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Fri May 27 14:23:26 PDT 2016


Author: davidxl
Date: Fri May 27 16:23:25 2016
New Revision: 271047

URL: http://llvm.org/viewvc/llvm-project?rev=271047&view=rev
Log:
FileCheck: dump command line context with empty input

Differential Revision: http://reviews.llvm.org/D20716


Modified:
    llvm/trunk/test/FileCheck/check-empty.txt
    llvm/trunk/utils/FileCheck/FileCheck.cpp

Modified: llvm/trunk/test/FileCheck/check-empty.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FileCheck/check-empty.txt?rev=271047&r1=271046&r2=271047&view=diff
==============================================================================
--- llvm/trunk/test/FileCheck/check-empty.txt (original)
+++ llvm/trunk/test/FileCheck/check-empty.txt Fri May 27 16:23:25 2016
@@ -7,5 +7,6 @@
 ; NOFOO-NOT: foo
 
 ; EMPTY-ERR: FileCheck error: '-' is empty.
+; EMPTY-ERR-NEXT: FileCheck command line: {{.*}}FileCheck -check-prefix={{.*}}FOO {{.*}}check-empty.txt
 ; NO-EMPTY-ERR-NOT: FileCheck error: '-' is empty.
 ; NOT-FOUND: error: expected string not found in input

Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/FileCheck/FileCheck.cpp?rev=271047&r1=271046&r2=271047&view=diff
==============================================================================
--- llvm/trunk/utils/FileCheck/FileCheck.cpp (original)
+++ llvm/trunk/utils/FileCheck/FileCheck.cpp Fri May 27 16:23:25 2016
@@ -1298,6 +1298,13 @@ static void AddCheckPrefixIfNeeded() {
     CheckPrefixes.push_back("CHECK");
 }
 
+static void DumpCommandLine(int argc, char **argv) {
+  errs() << "FileCheck command line: ";
+  for (int I = 0; I < argc; I++)
+    errs() << " " << argv[I];
+  errs() << "\n";
+}
+
 int main(int argc, char **argv) {
   sys::PrintStackTraceOnErrorSignal();
   PrettyStackTraceProgram X(argc, argv);
@@ -1331,6 +1338,7 @@ int main(int argc, char **argv) {
 
   if (File->getBufferSize() == 0 && !AllowEmptyInput) {
     errs() << "FileCheck error: '" << InputFilename << "' is empty.\n";
+    DumpCommandLine(argc, argv);
     return 2;
   }
 




More information about the llvm-commits mailing list