diff --git a/llvm/test/tools/llvm-cov/misssing-profdata.test b/llvm/test/tools/llvm-cov/misssing-profdata.test new file mode 100644 --- /dev/null +++ b/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 diff --git a/llvm/tools/llvm-cov/CodeCoverage.cpp b/llvm/tools/llvm-cov/CodeCoverage.cpp --- a/llvm/tools/llvm-cov/CodeCoverage.cpp +++ b/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; }