Display profile file name when emitting a file not found diagnostic.

When a profile file cannot be opened, we used to display just the error
message but not the name of the profile the compiler was trying to open.
This will become useful in the next set of patches that introduce
GCC-compatible flags to specify profiles.

llvm-svn: 240715
This commit is contained in:
Diego Novillo 2015-06-25 22:56:00 +00:00
parent 164a6098a9
commit 5aecacb275
2 changed files with 4 additions and 3 deletions

View File

@ -145,8 +145,9 @@ CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO,
llvm::IndexedInstrProfReader::create(CodeGenOpts.InstrProfileInput); llvm::IndexedInstrProfReader::create(CodeGenOpts.InstrProfileInput);
if (std::error_code EC = ReaderOrErr.getError()) { if (std::error_code EC = ReaderOrErr.getError()) {
unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error, unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
"Could not read profile: %0"); "Could not read profile %0: %1");
getDiags().Report(DiagID) << EC.message(); getDiags().Report(DiagID) << CodeGenOpts.InstrProfileInput
<< EC.message();
} else } else
PGOReader = std::move(ReaderOrErr.get()); PGOReader = std::move(ReaderOrErr.get());
} }

View File

@ -1,4 +1,4 @@
// RUN: not %clang_cc1 -emit-llvm %s -o - -fprofile-instr-use=%t.nonexistent.profdata 2>&1 | FileCheck %s // RUN: not %clang_cc1 -emit-llvm %s -o - -fprofile-instr-use=%t.nonexistent.profdata 2>&1 | FileCheck %s
// CHECK: error: Could not read profile: // CHECK: error: Could not read profile {{.*}}.nonexistent.profdata:
// CHECK-NOT: Assertion failed // CHECK-NOT: Assertion failed