diff options
author | Alan Phipps <a-phipps@ti.com> | 2023-12-13 14:13:56 -0600 |
---|---|---|
committer | Alan Phipps <a-phipps@ti.com> | 2023-12-13 15:10:05 -0600 |
commit | 8ecbb0404d740d1ab173554e47cef39cd5e3ef8c (patch) | |
tree | 93cc0afc02965f5ccc27dc83c7389662ef772661 /llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp | |
parent | 14d7e0bb0f75066da5d2eff718b6d59215a02077 (diff) | |
download | llvm-8ecbb0404d740d1ab173554e47cef39cd5e3ef8c.zip llvm-8ecbb0404d740d1ab173554e47cef39cd5e3ef8c.tar.gz llvm-8ecbb0404d740d1ab173554e47cef39cd5e3ef8c.tar.bz2 |
Reland "[Coverage][llvm-cov] Enable MC/DC Support in LLVM Source-based Code Coverage (2/3)"
Part 2 of 3. This includes the Visualization and Evaluation components.
Differential Revision: https://reviews.llvm.org/D138847
Diffstat (limited to 'llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp')
-rw-r--r-- | llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp b/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp index d6aade6..56a7ab2 100644 --- a/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp +++ b/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp @@ -244,6 +244,7 @@ Error RawCoverageMappingReader::readMappingRegionsSubArray( unsigned LineStart = 0; for (size_t I = 0; I < NumRegions; ++I) { Counter C, C2; + uint64_t BIDX = 0, NC = 0, ID = 0, TID = 0, FID = 0; CounterMappingRegion::RegionKind Kind = CounterMappingRegion::CodeRegion; // Read the combined counter + region kind. @@ -294,6 +295,27 @@ Error RawCoverageMappingReader::readMappingRegionsSubArray( if (auto Err = readCounter(C2)) return Err; break; + case CounterMappingRegion::MCDCBranchRegion: + // For a MCDC Branch Region, read two successive counters and 3 IDs. + Kind = CounterMappingRegion::MCDCBranchRegion; + if (auto Err = readCounter(C)) + return Err; + if (auto Err = readCounter(C2)) + return Err; + if (auto Err = readIntMax(ID, std::numeric_limits<unsigned>::max())) + return Err; + if (auto Err = readIntMax(TID, std::numeric_limits<unsigned>::max())) + return Err; + if (auto Err = readIntMax(FID, std::numeric_limits<unsigned>::max())) + return Err; + break; + case CounterMappingRegion::MCDCDecisionRegion: + Kind = CounterMappingRegion::MCDCDecisionRegion; + if (auto Err = readIntMax(BIDX, std::numeric_limits<unsigned>::max())) + return Err; + if (auto Err = readIntMax(NC, std::numeric_limits<unsigned>::max())) + return Err; + break; default: return make_error<CoverageMapError>(coveragemap_error::malformed, "region kind is incorrect"); @@ -347,9 +369,14 @@ Error RawCoverageMappingReader::readMappingRegionsSubArray( dbgs() << "\n"; }); - auto CMR = CounterMappingRegion(C, C2, InferredFileID, ExpandedFileID, - LineStart, ColumnStart, - LineStart + NumLines, ColumnEnd, Kind); + auto CMR = CounterMappingRegion( + C, C2, + CounterMappingRegion::MCDCParameters{ + static_cast<unsigned>(BIDX), static_cast<unsigned>(NC), + static_cast<unsigned>(ID), static_cast<unsigned>(TID), + static_cast<unsigned>(FID)}, + InferredFileID, ExpandedFileID, LineStart, ColumnStart, + LineStart + NumLines, ColumnEnd, Kind); if (CMR.startLoc() > CMR.endLoc()) return make_error<CoverageMapError>( coveragemap_error::malformed, |