Index: clang/test/Import/missing-import/test.c =================================================================== --- clang/test/Import/missing-import/test.c +++ clang/test/Import/missing-import/test.c @@ -1,5 +1,5 @@ // RUN: not clang-import-test -import %S/Inputs/S.c -expression %s 2>&1 | FileCheck %s -// CHECK: {{.*}}Couldn't open{{.*}}Inputs/S.c{{.*}} +// CHECK: error: No such file or directory: {{.*}}Inputs/S.c{{$}} void expr() { struct S MyS; void *MyPtr = &MyS; Index: clang/tools/clang-import-test/clang-import-test.cpp =================================================================== --- clang/tools/clang-import-test/clang-import-test.cpp +++ clang/tools/clang-import-test/clang-import-test.cpp @@ -289,10 +289,11 @@ llvm::Error ParseSource(const std::string &Path, CompilerInstance &CI, ASTConsumer &Consumer) { SourceManager &SM = CI.getSourceManager(); - auto FE = CI.getFileManager().getFile(Path); + auto FE = CI.getFileManager().getFileRef(Path); if (!FE) { return llvm::make_error( - llvm::Twine("Couldn't open ", Path), std::error_code()); + llvm::Twine(llvm::toString(FE.takeError())) + ": " + Path, + std::error_code()); } SM.setMainFileID(SM.createFileID(*FE, SourceLocation(), SrcMgr::C_User)); ParseAST(CI.getPreprocessor(), &Consumer, CI.getASTContext()); @@ -360,7 +361,7 @@ for (auto I : Imports) { llvm::Expected ImportCI = Parse(I, {}, false, false); if (auto E = ImportCI.takeError()) { - llvm::errs() << llvm::toString(std::move(E)); + llvm::errs() << "error: " << llvm::toString(std::move(E)) << "\n"; exit(-1); } ImportCIs.push_back(std::move(*ImportCI)); @@ -379,7 +380,7 @@ Parse(Expression, (Direct && !UseOrigins) ? ImportCIs : IndirectCIs, DumpAST, DumpIR); if (auto E = ExpressionCI.takeError()) { - llvm::errs() << llvm::toString(std::move(E)); + llvm::errs() << "error: " << llvm::toString(std::move(E)) << "\n"; exit(-1); } Forget(*ExpressionCI, (Direct && !UseOrigins) ? ImportCIs : IndirectCIs);