Rollup merge of #91207 - richkadel:rk-bump-coverage-version, r=tmandry
Add support for LLVM coverage mapping format versions 5 and 6 This PR cherry-pick's Swatinem's initial commit in unsubmitted PR #90047. My additional commit augments Swatinem's great starting point, but adds full support for LLVM Coverage Mapping Format version 6, conditionally, if compiling with LLVM 13. Version 6 requires adding the compilation directory when file paths are relative, and since Rustc coverage maps use relative paths, we should add the expected compilation directory entry. Note, however, that with the compilation directory, coverage reports from `llvm-cov show` can now report file names (when the report includes more than one file) with the full absolute path to the file. This would be a problem for test results, but the workaround (for the rust coverage tests) is to include an additional `llvm-cov show` parameter: `--compilation-dir=.`
This commit is contained in:
commit
d93df5775c
8 changed files with 101 additions and 24 deletions
|
@ -10,6 +10,7 @@ using namespace llvm;
|
|||
|
||||
struct LLVMRustCounterMappingRegion {
|
||||
coverage::Counter Count;
|
||||
coverage::Counter FalseCount;
|
||||
uint32_t FileID;
|
||||
uint32_t ExpandedFileID;
|
||||
uint32_t LineStart;
|
||||
|
@ -53,7 +54,7 @@ extern "C" void LLVMRustCoverageWriteMappingToBuffer(
|
|||
MappingRegions.reserve(NumMappingRegions);
|
||||
for (const auto &Region : makeArrayRef(RustMappingRegions, NumMappingRegions)) {
|
||||
MappingRegions.emplace_back(
|
||||
Region.Count, Region.FileID, Region.ExpandedFileID,
|
||||
Region.Count, Region.FalseCount, Region.FileID, Region.ExpandedFileID,
|
||||
Region.LineStart, Region.ColumnStart, Region.LineEnd, Region.ColumnEnd,
|
||||
Region.Kind);
|
||||
}
|
||||
|
@ -108,5 +109,9 @@ extern "C" void LLVMRustCoverageWriteMappingVarNameToString(RustStringRef Str) {
|
|||
}
|
||||
|
||||
extern "C" uint32_t LLVMRustCoverageMappingVersion() {
|
||||
return coverage::CovMapVersion::Version4;
|
||||
#if LLVM_VERSION_GE(13, 0)
|
||||
return coverage::CovMapVersion::Version6;
|
||||
#else
|
||||
return coverage::CovMapVersion::Version5;
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue