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!
Differential Revision: https://reviews.llvm.org/D76796
--- /dev/null
+RUN: not llvm-cov show -instr-profile=%t.nonexistent %t.nonexistent 2>&1 | FileCheck %s
+CHECK: Could not read profile data
}
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;
}