FileCheck: dump command line context with empty input

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271047 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Xinliang David Li 2016-05-27 21:23:25 +00:00
parent c1712d6440
commit a5135a874c
2 changed files with 9 additions and 0 deletions

View File

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

View File

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