]> granicus.if.org Git - clang/commitdiff
Display profile file name when emitting a file not found diagnostic.
authorDiego Novillo <dnovillo@google.com>
Thu, 25 Jun 2015 22:56:00 +0000 (22:56 +0000)
committerDiego Novillo <dnovillo@google.com>
Thu, 25 Jun 2015 22:56:00 +0000 (22:56 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240715 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenModule.cpp
test/Profile/profile-does-not-exist.c

index 2dd5414795e7340f307b2c6a94700d7a231f3601..bd7b44e413355c3548fb8d7f73e7d568ac65e33a 100644 (file)
@@ -145,8 +145,9 @@ CodeGenModule::CodeGenModule(ASTContext &C, const CodeGenOptions &CGO,
         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());
   }
index 89609bd945d6718e7b9b1752ea284b9865452629..d45981faffed8491e7c411fcfa4bc12f33c99db3 100644 (file)
@@ -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