[all-commits] [llvm/llvm-project] 395e62: [llvm-cov] Add failing test for gap region line co...
Maksim Levental via All-commits
all-commits at lists.llvm.org
Sat Jun 13 16:37:12 PDT 2026
Branch: refs/heads/users/makslevental/fix-gap-region-line-coverage
Home: https://github.com/llvm/llvm-project
Commit: 395e62e7e9c66f64ee5ab3f931e11f753833dd47
https://github.com/llvm/llvm-project/commit/395e62e7e9c66f64ee5ab3f931e11f753833dd47
Author: makslevental <maksim.levental at gmail.com>
Date: 2026-06-13 (Sat, 13 Jun 2026)
Changed paths:
A llvm/test/tools/llvm-cov/Inputs/gap-region-quirk/gap-quirk.covmapping
A llvm/test/tools/llvm-cov/Inputs/gap-region-quirk/gap-quirk.cpp
A llvm/test/tools/llvm-cov/Inputs/gap-region-quirk/gap-quirk.profdata
A llvm/test/tools/llvm-cov/gap-region-line-coverage.test
Log Message:
-----------
[llvm-cov] Add failing test for gap region line coverage bug
LineCoverageStats incorrectly reports a line as uncovered when the
wrapping segment has count=0 and the line has no region entries, even
if it has non-entry segments with count > 0.
This test uses coverage data from Apple clang which produces the
specific segment pattern that triggers this: a closing brace "}" after
a never-taken if-block, where the non-gap segment returning to the
parent function's count is ignored.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply at anthropic.com>
Commit: f20f81cc976d692ec0fcf91164aafaa0ee88b9e6
https://github.com/llvm/llvm-project/commit/f20f81cc976d692ec0fcf91164aafaa0ee88b9e6
Author: makslevental <maksim.levental at gmail.com>
Date: 2026-06-13 (Sat, 13 Jun 2026)
Changed paths:
M llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
Log Message:
-----------
[CoverageMapping] Fix LineCoverageStats incorrectly using gap region count
When a line's wrapping segment is a gap region with count=0, but the
line has non-gap segments with count > 0 (not region entries),
LineCoverageStats incorrectly reports the line as uncovered.
This happens when a zero-count region (e.g., from a never-taken
if-branch) extends past subsequent covered lines via a gap segment.
The fix:
1. Skip initializing ExecutionCount from gap wrapping segments
2. When MinRegionCount is 0, check non-gap HasCount segments on the
line and use their max count
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply at anthropic.com>
Compare: https://github.com/llvm/llvm-project/compare/395e62e7e9c6%5E...f20f81cc976d
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list