aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index f42bf30..9f92410 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1293,12 +1293,15 @@ static std::string serializeXRayInstrumentationBundle(const XRayInstrSet &S) {
// Set the profile kind using fprofile-instrument-use-path.
static void setPGOUseInstrumentor(CodeGenOptions &Opts,
- const Twine &ProfileName) {
+ const Twine &ProfileName,
+ DiagnosticsEngine &Diags) {
auto ReaderOrErr = llvm::IndexedInstrProfReader::create(ProfileName);
- // In error, return silently and let Clang PGOUse report the error message.
if (auto E = ReaderOrErr.takeError()) {
- llvm::consumeError(std::move(E));
- Opts.setProfileUse(CodeGenOptions::ProfileClangInstr);
+ unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
+ "Error in reading profile %0: %1");
+ llvm::handleAllErrors(std::move(E), [&](const llvm::ErrorInfoBase &EI) {
+ Diags.Report(DiagID) << ProfileName.str() << EI.message();
+ });
return;
}
std::unique_ptr<llvm::IndexedInstrProfReader> PGOReader =
@@ -1712,7 +1715,7 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
}
if (!Opts.ProfileInstrumentUsePath.empty())
- setPGOUseInstrumentor(Opts, Opts.ProfileInstrumentUsePath);
+ setPGOUseInstrumentor(Opts, Opts.ProfileInstrumentUsePath, Diags);
if (const Arg *A = Args.getLastArg(OPT_ftime_report, OPT_ftime_report_EQ)) {
Opts.TimePasses = true;