diff --git a/llvm/test/FileCheck/check-empty.txt b/llvm/test/FileCheck/check-empty.txt --- a/llvm/test/FileCheck/check-empty.txt +++ b/llvm/test/FileCheck/check-empty.txt @@ -17,7 +17,7 @@ ; FOO: foo ; NOFOO-NOT: foo -; EMPTY-ERR: FileCheck error: '-' is empty. +; EMPTY-ERR: FileCheck error: '' is empty. ; EMPTY-ERR-NEXT: FileCheck command line: {{.*}}{{F|f}}ile{{C|c}}heck{{.*}}-check-prefix={{.*}}FOO {{.*}}check-empty.txt -; NO-EMPTY-ERR-NOT: FileCheck error: '-' is empty. +; NO-EMPTY-ERR-NOT: FileCheck error: '' is empty. ; NOT-FOUND: error: FOO: expected string not found in input diff --git a/llvm/utils/FileCheck/FileCheck.cpp b/llvm/utils/FileCheck/FileCheck.cpp --- a/llvm/utils/FileCheck/FileCheck.cpp +++ b/llvm/utils/FileCheck/FileCheck.cpp @@ -33,7 +33,7 @@ static cl::opt InputFilename("input-file", cl::desc("File to check (defaults to stdin)"), - cl::init("-"), cl::value_desc("filename")); + cl::init(""), cl::value_desc("filename")); static cl::list CheckPrefixes( "check-prefix", @@ -615,7 +615,8 @@ // Open the file to check and add it to SourceMgr. ErrorOr> InputFileOrErr = - MemoryBuffer::getFileOrSTDIN(InputFilename); + MemoryBuffer::getFileOrSTDIN( + (InputFilename == "" ? "-" : InputFilename.getValue())); if (std::error_code EC = InputFileOrErr.getError()) { errs() << "Could not open input file '" << InputFilename << "': " << EC.message() << '\n'; @@ -648,7 +649,7 @@ (ExitCode == 1 && DumpInput == DumpInputFail)) { errs() << "\n" << "Input file: " - << (InputFilename == "-" ? "" : InputFilename.getValue()) + << InputFilename << "\n" << "Check file: " << CheckFilename << "\n" << "\n"