diff options
author | Max Moroz <mmoroz@chromium.org> | 2018-04-09 15:20:35 +0000 |
---|---|---|
committer | Max Moroz <mmoroz@chromium.org> | 2018-04-09 15:20:35 +0000 |
commit | 4220f89107c49e7db2247e575263ccd752cdf442 (patch) | |
tree | 2af9607851ab1d140de7fccb0507b4ffab8f0de5 /llvm/tools/llvm-cov/CoverageReport.cpp | |
parent | ea9773ac69389c6eac82384b3cf98ceb774ff740 (diff) | |
download | bcm5719-llvm-4220f89107c49e7db2247e575263ccd752cdf442.tar.gz bcm5719-llvm-4220f89107c49e7db2247e575263ccd752cdf442.zip |
[llvm-cov] Implement -ignore-filename-regex= option for excluding source files.
Summary:
The option is helpful for large projects where it's not feasible to specify sources which
user would like to see in the report. Instead, it allows to black-list specific sources via
regular expressions (e.g. now it's possible to skip all files that have "test" in its name).
This also partially fixes https://bugs.llvm.org/show_bug.cgi?id=34277
Reviewers: vsk, morehouse, liaoyuke
Reviewed By: vsk
Subscribers: kcc, mgorny, llvm-commits
Differential Revision: https://reviews.llvm.org/D43907
llvm-svn: 329581
Diffstat (limited to 'llvm/tools/llvm-cov/CoverageReport.cpp')
-rw-r--r-- | llvm/tools/llvm-cov/CoverageReport.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/tools/llvm-cov/CoverageReport.cpp b/llvm/tools/llvm-cov/CoverageReport.cpp index aafdc433775..5d892202f0d 100644 --- a/llvm/tools/llvm-cov/CoverageReport.cpp +++ b/llvm/tools/llvm-cov/CoverageReport.cpp @@ -379,10 +379,14 @@ std::vector<FileCoverageSummary> CoverageReport::prepareFileReports( return FileReports; } -void CoverageReport::renderFileReports(raw_ostream &OS) const { +void CoverageReport::renderFileReports( + raw_ostream &OS, const CoverageFilters &IgnoreFilenameFilters) const { std::vector<std::string> UniqueSourceFiles; - for (StringRef SF : Coverage.getUniqueSourceFiles()) - UniqueSourceFiles.emplace_back(SF.str()); + for (StringRef SF : Coverage.getUniqueSourceFiles()) { + // Apply ignore source files filters. + if (!IgnoreFilenameFilters.matchesFilename(SF)) + UniqueSourceFiles.emplace_back(SF.str()); + } renderFileReports(OS, UniqueSourceFiles); } |