[llvm] llvm-cov: Calculate RegionCoverage based on `CoverageData::Segments` (PR #121191)

NAKAMURA Takumi via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 5 21:13:48 PST 2025


================
@@ -63,14 +63,15 @@ auto sumMCDCPairs(const ArrayRef<MCDCRecord> &Records) {
 }
 
 static std::pair<RegionCoverageInfo, LineCoverageInfo>
-sumRegions(ArrayRef<CountedRegion> CodeRegions, const CoverageData &CD) {
+sumRegions(const CoverageData &CD) {
   // Compute the region coverage.
   size_t NumCodeRegions = 0, CoveredRegions = 0;
-  for (auto &CR : CodeRegions) {
-    if (CR.Kind != CounterMappingRegion::CodeRegion)
+  for (auto I = CD.begin(), E = CD.end(); I != E; ++I) {
----------------
chapuni wrote:

Iterators (for protected:Segments) are provided by CoverageData. I think range is less suitable here.

https://github.com/llvm/llvm-project/pull/121191


More information about the llvm-commits mailing list