[llvm] [llvm-cov] Introduce `-include-filename-regex` (PR #175779)
Lucas Chollet via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 14 13:18:28 PST 2026
LucasChollet wrote:
The motivation is described here: https://github.com/SerenityOS/serenity/pull/26541
But in short, in the project we have multiple libraries and our tests are organized per-libraries. We generate a global coverage report with the result of all combined tests, but I also wanted to generate per-library reports. The goal is to ensure that the coverage result of `LibA` is provided by `TestA` and not because `TestB` tests `LibB` which in turns calls into `LibA`.
To generate these reports, my `llvm-cov` command line looks like this:
```bash
llvm-cov show $all_test_binaries \
-format html \
-show-line-counts-or-regions -show-directory-coverage \
-Xdemangler $CLANG_BINDIR/llvm-cxxfilt -Xdemangler -n \
-instr-profile "$TEMP_PROFDATA/profiles/$library/$library.profdata" \
-o "$BUILD_DIR/reports/$library" \
-compilation-dir=$SERENITY_ROOT \ # We pass all the sources from the repo.
-ignore-filename-regex=(Meta|Tests|Build|Kernel) \ # Filter out some indesirables.
-include-filename-regex="\/$library\/" # Filter in the source of the library for which we generate the report.
```
This patch adds `-include-filename-regex` which is basically the same as `-ignore-filename-regex` but it filters-in instead of filtering out. The modifications to the existing code is simply to reuse the components that are already in place for `-ignore-filename-regex`. So this PR doesn't change the behavior of `llvm-cov` (except of course when the new flag is passed).
I hope this answer your questions!
https://github.com/llvm/llvm-project/pull/175779
More information about the llvm-commits
mailing list