[llvm-cov] Add option to exclude macro expansions from summaries
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
While working on a PostgreSQL patch and trying to drive a source file to 100%
coverage, I ran into a confusing mismatch between llvm-cov's summary output and
its HTML source view.
`llvm-cov report` and the `llvm-cov show --format=html` index can report
incomplete region or branch coverage even when the default per-file source view
has no visible uncovered line, region, or branch target.
In the PostgreSQL case, the HTML index showed less than 100% region and branch
coverage for a source file, but opening the file view and using the built-in
navigation helpers did not find anything:
- `next_line()` found no uncovered line.
- `next_region()` found no uncovered region.
- `next_branch()` found no uncovered branch.
The missing coverage was coming from macro expansion internals. File and index
summaries include coverage mapping data from macro expansion file IDs, while
the default source view does not show macro expansion bodies unless
`--show-expansions` is used. For source-focused coverage workflows, that makes
the summary look actionable even though the default visible source view has
nothing to inspect.
It would be useful to have an opt-in mode for source-focused summaries, for
example:
```text
--summary-skip-expansions
Contributor guide
Research direction
Start with llvm-cov report and llvm-cov show --format=html, comparing their summary handling with the existing --show-expansions behavior. Trace how macro expansion file IDs contribute to summaries and make the proposed opt-in summary mode exclude them while preserving current defaults. Done means source-focused summaries match the visible default source view without requiring expansion display.
Written by the indexing model from the issue text.
Assessment
- Domain
- cli, devtools, testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100