[llvm-cov] Remove deprecated -name-whitelist after D112816
GitOrigin-RevId: 1c52b4f798de54e2945867f2d8040ada773fa7eb
diff --git a/docs/CommandGuide/llvm-cov.rst b/docs/CommandGuide/llvm-cov.rst
index 61db8f6..319835d 100644
--- a/docs/CommandGuide/llvm-cov.rst
+++ b/docs/CommandGuide/llvm-cov.rst
@@ -271,13 +271,6 @@
the file should start with `allowlist_fun:`, immediately followed by the name
of the function to accept. This name can be a wildcard expression.
-.. option:: -name-whitelist=<FILE>
-
- Show code coverage only for functions listed in the given file. Each line in
- the file should start with `whitelist_fun:`, immediately followed by the name
- of the function to accept. This name can be a wildcard expression. This option
- will be deprecated for `-name-allowlist=<FILE>` in future releases.
-
.. option:: -name-regex=<PATTERN>
Show code coverage only for functions that match the given regular expression.
diff --git a/test/tools/llvm-cov/name_whitelist.test b/test/tools/llvm-cov/name_whitelist.test
deleted file mode 100644
index 3eb21e5..0000000
--- a/test/tools/llvm-cov/name_whitelist.test
+++ /dev/null
@@ -1,21 +0,0 @@
-RUN: llvm-profdata merge %S/Inputs/name_whitelist.proftext -o %t.profdata
-
-RUN: llvm-cov show %S/Inputs/name_whitelist.covmapping -instr-profile=%t.profdata -path-equivalence=/tmp,%S/Inputs -name-whitelist=%S/Inputs/whitelist1.txt %S/Inputs/name_whitelist.cpp > %t.one_list
-RUN: FileCheck -input-file=%t.one_list -check-prefix=ONE_WHITELIST %s
-RUN: FileCheck -input-file=%t.one_list -check-prefix=ONE_WHITELIST_NEG %s
-ONE_WHITELIST: _Z5func1v:
-ONE_WHITELIST: _Z5func2v:
-ONE_WHITELIST_NEG-NOT: _Z5func3v:
-ONE_WHITELIST_NEG-NOT: _Z5func4v:
-ONE_WHITELIST_NEG-NOT: _Z5func5v:
-ONE_WHITELIST_NEG-NOT: _Z5func6v:
-
-RUN: llvm-cov show %S/Inputs/name_whitelist.covmapping -instr-profile=%t.profdata -path-equivalence=/tmp,%S/Inputs -name-whitelist=%S/Inputs/whitelist1.txt -name-whitelist=%S/Inputs/whitelist2.txt %S/Inputs/name_whitelist.cpp > %t.two_list
-RUN: FileCheck -input-file=%t.two_list -check-prefix=TWO_WHITELIST %s
-RUN: FileCheck -input-file=%t.two_list -check-prefix=TWO_WHITELIST_NEG %s
-TWO_WHITELIST: _Z5func1v:
-TWO_WHITELIST: _Z5func2v:
-TWO_WHITELIST: _Z5func3v:
-TWO_WHITELIST: _Z5func4v:
-TWO_WHITELIST_NEG-NOT: _Z5func5v:
-TWO_WHITELIST_NEG-NOT: _Z5func6v:
diff --git a/tools/llvm-cov/CodeCoverage.cpp b/tools/llvm-cov/CodeCoverage.cpp
index 13b6c30..c963a60 100644
--- a/tools/llvm-cov/CodeCoverage.cpp
+++ b/tools/llvm-cov/CodeCoverage.cpp
@@ -671,13 +671,6 @@
"file"),
cl::cat(FilteringCategory));
- // Allow for accepting previous option name.
- cl::list<std::string> NameFilterFilesDeprecated(
- "name-whitelist", cl::Optional, cl::Hidden,
- cl::desc("Show code coverage only for functions listed in the given "
- "file. Deprecated, use -name-allowlist instead"),
- cl::cat(FilteringCategory));
-
cl::list<std::string> NameRegexFilters(
"name-regex", cl::Optional,
cl::desc("Show code coverage only for functions that match the given "
@@ -815,16 +808,10 @@
}
// Read in -name-allowlist files.
- if (!NameFilterFiles.empty() || !NameFilterFilesDeprecated.empty()) {
+ if (!NameFilterFiles.empty()) {
std::string SpecialCaseListErr;
- if (!NameFilterFiles.empty())
- NameAllowlist = SpecialCaseList::create(
- NameFilterFiles, *vfs::getRealFileSystem(), SpecialCaseListErr);
- if (!NameFilterFilesDeprecated.empty())
- NameAllowlist = SpecialCaseList::create(NameFilterFilesDeprecated,
- *vfs::getRealFileSystem(),
- SpecialCaseListErr);
-
+ NameAllowlist = SpecialCaseList::create(
+ NameFilterFiles, *vfs::getRealFileSystem(), SpecialCaseListErr);
if (!NameAllowlist)
error(SpecialCaseListErr);
}
@@ -834,14 +821,9 @@
auto NameFilterer = std::make_unique<CoverageFilters>();
for (const auto &Name : NameFilters)
NameFilterer->push_back(std::make_unique<NameCoverageFilter>(Name));
- if (NameAllowlist) {
- if (!NameFilterFiles.empty())
- NameFilterer->push_back(
- std::make_unique<NameAllowlistCoverageFilter>(*NameAllowlist));
- if (!NameFilterFilesDeprecated.empty())
- NameFilterer->push_back(
- std::make_unique<NameWhitelistCoverageFilter>(*NameAllowlist));
- }
+ if (NameAllowlist && !NameFilterFiles.empty())
+ NameFilterer->push_back(
+ std::make_unique<NameAllowlistCoverageFilter>(*NameAllowlist));
for (const auto &Regex : NameRegexFilters)
NameFilterer->push_back(
std::make_unique<NameRegexCoverageFilter>(Regex));
diff --git a/tools/llvm-cov/CoverageFilters.cpp b/tools/llvm-cov/CoverageFilters.cpp
index b799864..bc1ddb4 100644
--- a/tools/llvm-cov/CoverageFilters.cpp
+++ b/tools/llvm-cov/CoverageFilters.cpp
@@ -40,13 +40,6 @@
return Allowlist.inSection("llvmcov", "allowlist_fun", Function.Name);
}
-// TODO: remove this when -name-whitelist option is removed.
-bool NameWhitelistCoverageFilter::matches(
- const coverage::CoverageMapping &,
- const coverage::FunctionRecord &Function) const {
- return Whitelist.inSection("llvmcov", "whitelist_fun", Function.Name);
-}
-
bool RegionCoverageFilter::matches(
const coverage::CoverageMapping &CM,
const coverage::FunctionRecord &Function) const {
diff --git a/tools/llvm-cov/CoverageFilters.h b/tools/llvm-cov/CoverageFilters.h
index 3040fe7..5345b0c 100644
--- a/tools/llvm-cov/CoverageFilters.h
+++ b/tools/llvm-cov/CoverageFilters.h
@@ -79,18 +79,6 @@
const coverage::FunctionRecord &Function) const override;
};
-// TODO: Remove this class when -name-whitelist option is removed.
-class NameWhitelistCoverageFilter : public CoverageFilter {
- const SpecialCaseList &Whitelist;
-
-public:
- NameWhitelistCoverageFilter(const SpecialCaseList &Whitelist)
- : Whitelist(Whitelist) {}
-
- bool matches(const coverage::CoverageMapping &CM,
- const coverage::FunctionRecord &Function) const override;
-};
-
/// Matches numbers that pass a certain threshold.
template <typename T> class StatisticThresholdFilter {
public: