[all-commits] [llvm/llvm-project] 0085ea: [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:42:34 PDT 2026
Branch: refs/heads/users/makslevental/fix-gap-region-line-coverage
Home: https://github.com/llvm/llvm-project
Commit: 0085eabcf96c95bd11222d8a66c770122d7cc5be
https://github.com/llvm/llvm-project/commit/0085eabcf96c95bd11222d8a66c770122d7cc5be
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: 983fd8919f15bc3b065b93a10fc5859bcfb1aee8
https://github.com/llvm/llvm-project/commit/983fd8919f15bc3b065b93a10fc5859bcfb1aee8
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/f20f81cc976d...983fd8919f15
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