mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
llvm-cov: Warn if object file is newer than profile
Looking at coverage with an out of date profile can be confusing. Provide a little hint that something might be wrong. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236408 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7dda4c92e4
commit
0e93e26d37
@ -195,7 +195,20 @@ CodeCoverageTool::createSourceFileView(StringRef SourceFile,
|
||||
return View;
|
||||
}
|
||||
|
||||
static bool modifiedTimeGT(StringRef LHS, StringRef RHS) {
|
||||
sys::fs::file_status Status;
|
||||
if (sys::fs::status(LHS, Status))
|
||||
return false;
|
||||
auto LHSTime = Status.getLastModificationTime();
|
||||
if (sys::fs::status(RHS, Status))
|
||||
return false;
|
||||
auto RHSTime = Status.getLastModificationTime();
|
||||
return LHSTime > RHSTime;
|
||||
}
|
||||
|
||||
std::unique_ptr<CoverageMapping> CodeCoverageTool::load() {
|
||||
if (modifiedTimeGT(ObjectFilename, PGOFilename))
|
||||
errs() << "warning: profile data may be out of date - object is newer\n";
|
||||
auto CoverageOrErr = CoverageMapping::load(ObjectFilename, PGOFilename,
|
||||
CoverageArch);
|
||||
if (std::error_code EC = CoverageOrErr.getError()) {
|
||||
|
Loading…
Reference in New Issue
Block a user