1
Fork 0

Update CoverageMappingFormat Support to Version6

Version 5 adds Branch Regions which are a prerequisite for branch coverage.
Version 6 can use the zeroth filename as prefix for other relative files.
This commit is contained in:
Arpad Borsos 2021-10-19 11:09:43 +02:00 committed by Rich Kadel
parent 7b3cd075bb
commit 566ad8da45
6 changed files with 66 additions and 23 deletions

View file

@ -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
}