[PATCH] D76796: [llvm-cov] Improve error message for missing profdata
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 25 12:59:38 PDT 2020
efriedma created this revision.
efriedma added a reviewer: vsk.
Herald added a project: LLVM.
I got a report recently that a user was having trouble interpreting the meaning of the error message. Hopefully this is more readable; produces something like the following:
error: No such file or directory: Could not read profile data.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D76796
Files:
llvm/test/tools/llvm-cov/misssing-profdata.test
llvm/tools/llvm-cov/CodeCoverage.cpp
Index: llvm/tools/llvm-cov/CodeCoverage.cpp
===================================================================
--- llvm/tools/llvm-cov/CodeCoverage.cpp
+++ llvm/tools/llvm-cov/CodeCoverage.cpp
@@ -867,8 +867,8 @@
}
sys::fs::file_status Status;
- if (sys::fs::status(PGOFilename, Status)) {
- error("profdata file error: can not get the file status. \n");
+ if (std::error_code EC = sys::fs::status(PGOFilename, Status)) {
+ error("Could not read profile data.", EC.message());
return 1;
}
Index: llvm/test/tools/llvm-cov/misssing-profdata.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-cov/misssing-profdata.test
@@ -0,0 +1,2 @@
+RUN: not llvm-cov show -instr-profile=%t.nonexistent %t.nonexistent 2>&1 | FileCheck %s
+CHECK: Could not read profile data
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76796.252648.patch
Type: text/x-patch
Size: 846 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200325/62d3e3b2/attachment.bin>
More information about the llvm-commits
mailing list