summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-cov/CoverageExporterJson.cpp
diff options
context:
space:
mode:
authorMax Moroz <mmoroz@chromium.org>2018-04-09 15:20:35 +0000
committerMax Moroz <mmoroz@chromium.org>2018-04-09 15:20:35 +0000
commit4220f89107c49e7db2247e575263ccd752cdf442 (patch)
tree2af9607851ab1d140de7fccb0507b4ffab8f0de5 /llvm/tools/llvm-cov/CoverageExporterJson.cpp
parentea9773ac69389c6eac82384b3cf98ceb774ff740 (diff)
downloadbcm5719-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/CoverageExporterJson.cpp')
-rw-r--r--llvm/tools/llvm-cov/CoverageExporterJson.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/llvm/tools/llvm-cov/CoverageExporterJson.cpp b/llvm/tools/llvm-cov/CoverageExporterJson.cpp
index 3621f9ab97f..fc631ac6d83 100644
--- a/llvm/tools/llvm-cov/CoverageExporterJson.cpp
+++ b/llvm/tools/llvm-cov/CoverageExporterJson.cpp
@@ -117,10 +117,13 @@ void CoverageExporterJson::emitArrayEnd() {
OS << "]";
}
-void CoverageExporterJson::renderRoot() {
+void CoverageExporterJson::renderRoot(
+ const CoverageFilters &IgnoreFilenameFilters) {
std::vector<std::string> SourceFiles;
- for (StringRef SF : Coverage.getUniqueSourceFiles())
- SourceFiles.emplace_back(SF);
+ for (StringRef SF : Coverage.getUniqueSourceFiles()) {
+ if (!IgnoreFilenameFilters.matchesFilename(SF))
+ SourceFiles.emplace_back(SF);
+ }
renderRoot(SourceFiles);
}
@@ -218,11 +221,11 @@ void CoverageExporterJson::renderFiles(
void CoverageExporterJson::renderFile(const std::string &Filename,
const FileCoverageSummary &FileReport) {
- // Start File.
+ // Start File.
emitDictStart();
emitDictElement("filename", Filename);
-
+
if (!Options.ExportSummaryOnly) {
// Calculate and render detailed coverage information for given file.
auto FileCoverage = Coverage.getCoverageForFile(Filename);
OpenPOWER on IntegriCloud