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

Diego Novillo dnovillo at google.com
Thu Jun 25 15:56:00 PDT 2015


Author: dnovillo
Date: Thu Jun 25 17:56:00 2015
New Revision: 240715

URL: http://llvm.org/viewvc/llvm-project?rev=240715&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp
    cfe/trunk/test/Profile/profile-does-not-exist.c

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=240715&r1=240714&r2=240715&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Thu Jun 25 17:56:00 2015
@@ -145,8 +145,9 @@ CodeGenModule::CodeGenModule(ASTContext
         llvm::IndexedInstrProfReader::create(CodeGenOpts.InstrProfileInput);
     if (std::error_code EC = ReaderOrErr.getError()) {
       unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
-                                              "Could not read profile: %0");
-      getDiags().Report(DiagID) << EC.message();
+                                              "Could not read profile %0: %1");
+      getDiags().Report(DiagID) << CodeGenOpts.InstrProfileInput
+                                << EC.message();
     } else
       PGOReader = std::move(ReaderOrErr.get());
   }

Modified: cfe/trunk/test/Profile/profile-does-not-exist.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Profile/profile-does-not-exist.c?rev=240715&r1=240714&r2=240715&view=diff
==============================================================================
--- cfe/trunk/test/Profile/profile-does-not-exist.c (original)
+++ cfe/trunk/test/Profile/profile-does-not-exist.c Thu Jun 25 17:56:00 2015
@@ -1,4 +1,4 @@
 // 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





More information about the cfe-commits mailing list