Revert "[llvm-cov] Add option to whitelist filenames"
This reverts commit bfed824b57d14e2ba98ddbaf1a1410cf04a3e279, the
included test fails on many bots including the sanitier bots, e.g. in
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/36140
diff --git a/llvm/tools/llvm-cov/CodeCoverage.cpp b/llvm/tools/llvm-cov/CodeCoverage.cpp
index 79c5845..7151cfb 100644
--- a/llvm/tools/llvm-cov/CodeCoverage.cpp
+++ b/llvm/tools/llvm-cov/CodeCoverage.cpp
@@ -126,7 +126,7 @@
std::vector<StringRef> ObjectFilenames;
CoverageViewOptions ViewOpts;
CoverageFiltersMatchAll Filters;
- FilenameCoverageFilters FilenameFilters;
+ CoverageFilters IgnoreFilenameFilters;
/// The path to the indexed profile.
std::string PGOFilename;
@@ -190,7 +190,7 @@
return;
}
sys::path::remove_dots(EffectivePath, /*remove_dot_dots=*/true);
- if (FilenameFilters.matchesFilename(EffectivePath))
+ if (!IgnoreFilenameFilters.matchesFilename(EffectivePath))
SourceFiles.emplace_back(EffectivePath.str());
}
@@ -595,12 +595,6 @@
"regular expression"),
cl::ZeroOrMore, cl::cat(FilteringCategory));
- cl::list<std::string> WhitelistFilenameRegexFilters(
- "whitelist-filename-regex", cl::Optional,
- cl::desc("Show code coverage only for file paths that match the given "
- "regular expression"),
- cl::ZeroOrMore, cl::cat(FilteringCategory));
-
cl::list<std::string> IgnoreFilenameRegexFilters(
"ignore-filename-regex", cl::Optional,
cl::desc("Skip source code files with file paths that match the given "
@@ -750,11 +744,10 @@
Filters.push_back(std::move(StatFilterer));
}
- // Create the filename filters.
+ // Create the ignore filename filters.
for (const auto &RE : IgnoreFilenameRegexFilters)
- FilenameFilters.blacklist(std::make_unique<NameRegexCoverageFilter>(RE));
- for (const auto &RE : WhitelistFilenameRegexFilters)
- FilenameFilters.whitelist(std::make_unique<NameRegexCoverageFilter>(RE));
+ IgnoreFilenameFilters.push_back(
+ std::make_unique<NameRegexCoverageFilter>(RE));
if (!Arches.empty()) {
for (const std::string &Arch : Arches) {
@@ -770,7 +763,7 @@
}
}
- // FilenameFilters are applied even when InputSourceFiles specified.
+ // IgnoreFilenameFilters are applied even when InputSourceFiles specified.
for (const std::string &File : InputSourceFiles)
collectPaths(File);
@@ -891,7 +884,7 @@
if (SourceFiles.empty())
// Get the source files from the function coverage mapping.
for (StringRef Filename : Coverage->getUniqueSourceFiles()) {
- if (FilenameFilters.matchesFilename(Filename))
+ if (!IgnoreFilenameFilters.matchesFilename(Filename))
SourceFiles.push_back(Filename);
}
@@ -995,7 +988,7 @@
CoverageReport Report(ViewOpts, *Coverage.get());
if (!ShowFunctionSummaries) {
if (SourceFiles.empty())
- Report.renderFileReports(llvm::outs(), FilenameFilters);
+ Report.renderFileReports(llvm::outs(), IgnoreFilenameFilters);
else
Report.renderFileReports(llvm::outs(), SourceFiles);
} else {
@@ -1061,7 +1054,7 @@
}
if (SourceFiles.empty())
- Exporter->renderRoot(FilenameFilters);
+ Exporter->renderRoot(IgnoreFilenameFilters);
else
Exporter->renderRoot(SourceFiles);