[all-commits] [llvm/llvm-project] baff7e: [llvm-cov] Add inline exclusion marker support for...
Maksim Levental via All-commits
all-commits at lists.llvm.org
Sat Jun 13 16:24:06 PDT 2026
Branch: refs/heads/users/makslevental/inline-excl-llvm-cov
Home: https://github.com/llvm/llvm-project
Commit: baff7e5aca1b75f8fa87882ab20befd46fea6606
https://github.com/llvm/llvm-project/commit/baff7e5aca1b75f8fa87882ab20befd46fea6606
Author: makslevental <maksim.levental at gmail.com>
Date: 2026-06-13 (Sat, 13 Jun 2026)
Changed paths:
A llvm/test/tools/llvm-cov/Inputs/exclude-markers-custom-region/report-custom-region.covmapping
A llvm/test/tools/llvm-cov/Inputs/exclude-markers-custom-region/report-custom-region.cpp
A llvm/test/tools/llvm-cov/Inputs/exclude-markers-custom-region/report-custom-region.profdata
A llvm/test/tools/llvm-cov/Inputs/exclude-markers-custom/report-custom.covmapping
A llvm/test/tools/llvm-cov/Inputs/exclude-markers-custom/report-custom.cpp
A llvm/test/tools/llvm-cov/Inputs/exclude-markers-custom/report-custom.profdata
A llvm/test/tools/llvm-cov/Inputs/exclude-markers-region/report-region.covmapping
A llvm/test/tools/llvm-cov/Inputs/exclude-markers-region/report-region.cpp
A llvm/test/tools/llvm-cov/Inputs/exclude-markers-region/report-region.profdata
A llvm/test/tools/llvm-cov/Inputs/exclude-markers/report.covmapping
A llvm/test/tools/llvm-cov/Inputs/exclude-markers/report.cpp
A llvm/test/tools/llvm-cov/Inputs/exclude-markers/report.profdata
A llvm/test/tools/llvm-cov/exclude-markers.test
M llvm/tools/llvm-cov/CodeCoverage.cpp
M llvm/tools/llvm-cov/CoverageExporterJson.cpp
M llvm/tools/llvm-cov/CoverageExporterLcov.cpp
M llvm/tools/llvm-cov/CoverageReport.cpp
M llvm/tools/llvm-cov/CoverageSummaryInfo.h
M llvm/tools/llvm-cov/CoverageViewOptions.h
M llvm/tools/llvm-cov/SourceCoverageView.cpp
M llvm/tools/llvm-cov/SourceCoverageView.h
M llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
M llvm/tools/llvm-cov/SourceCoverageViewHTML.h
M llvm/tools/llvm-cov/SourceCoverageViewText.cpp
M llvm/tools/llvm-cov/SourceCoverageViewText.h
Log Message:
-----------
[llvm-cov] Add inline exclusion marker support for coverage reporting
Add --exclude-line-regex, --exclude-region-start-regex, and
--exclude-region-stop-regex options to llvm-cov. These allow excluding
lines from coverage totals based on inline source comments.
Defaults: LCOV_EXCL_LINE (single line), LCOV_EXCL_START/LCOV_EXCL_STOP
(region). This brings parity with lcov/gcov's exclusion markers and
kcov's --exclude-line regex support.
The implementation scans source files for markers when loaded, builds a
per-file set of excluded line numbers, and consistently applies
exclusions across all output formats:
- Line coverage totals (subtracted in prepareFileReports)
- Region coverage totals (regions starting on excluded lines)
- Function coverage totals (functions starting on excluded lines)
- "show" text output (no count column, no red highlighting)
- "show" HTML output (skipped-line class instead of uncovered-line)
- JSON export segments (filtered out)
- LCOV export DA/FN/FNDA/BRDA entries (filtered out)
A function or region is excluded if its first line (start line) falls
on an excluded line. Branches on excluded lines are also excluded.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply at anthropic.com>
Commit: cbdb857e8e81f4c952f43b1256fe77531cd1fe40
https://github.com/llvm/llvm-project/commit/cbdb857e8e81f4c952f43b1256fe77531cd1fe40
Author: makslevental <m_levental at apple.com>
Date: 2026-06-13 (Sat, 13 Jun 2026)
Changed paths:
M llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
M llvm/test/tools/llvm-cov/exclude-markers.test
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 gap region (e.g., from a never-taken
if-branch closing brace) extends past subsequent covered lines. The
fix checks non-gap HasCount segments on the line when MinRegionCount
is 0, using their max count instead of the gap's count.
Also skip initializing ExecutionCount from a gap wrapping segment,
since gap regions should not contribute to the line's execution count.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply at anthropic.com>
Compare: https://github.com/llvm/llvm-project/compare/efc03bd5c885...cbdb857e8e81
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