[llvm] 1c52b4f - [llvm-cov] Remove deprecated -name-whitelist after D112816
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 1 18:53:24 PDT 2022
Author: Fangrui Song
Date: 2022-08-01T18:53:20-07:00
New Revision: 1c52b4f798de54e2945867f2d8040ada773fa7eb
URL: https://github.com/llvm/llvm-project/commit/1c52b4f798de54e2945867f2d8040ada773fa7eb
DIFF: https://github.com/llvm/llvm-project/commit/1c52b4f798de54e2945867f2d8040ada773fa7eb.diff
LOG: [llvm-cov] Remove deprecated -name-whitelist after D112816
Added:
Modified:
llvm/docs/CommandGuide/llvm-cov.rst
llvm/tools/llvm-cov/CodeCoverage.cpp
llvm/tools/llvm-cov/CoverageFilters.cpp
llvm/tools/llvm-cov/CoverageFilters.h
Removed:
llvm/test/tools/llvm-cov/name_whitelist.test
################################################################################
diff --git a/llvm/docs/CommandGuide/llvm-cov.rst b/llvm/docs/CommandGuide/llvm-cov.rst
index 61db8f641b043..319835de168a9 100644
--- a/llvm/docs/CommandGuide/llvm-cov.rst
+++ b/llvm/docs/CommandGuide/llvm-cov.rst
@@ -271,13 +271,6 @@ OPTIONS
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/llvm/test/tools/llvm-cov/name_whitelist.test b/llvm/test/tools/llvm-cov/name_whitelist.test
deleted file mode 100644
index 3eb21e5d33286..0000000000000
--- a/llvm/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/llvm/tools/llvm-cov/CodeCoverage.cpp b/llvm/tools/llvm-cov/CodeCoverage.cpp
index 13b6c3002216b..c963a6052d48e 100644
--- a/llvm/tools/llvm-cov/CodeCoverage.cpp
+++ b/llvm/tools/llvm-cov/CodeCoverage.cpp
@@ -671,13 +671,6 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
"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 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
}
// 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 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
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/llvm/tools/llvm-cov/CoverageFilters.cpp b/llvm/tools/llvm-cov/CoverageFilters.cpp
index b7998647cc57e..bc1ddb41087f9 100644
--- a/llvm/tools/llvm-cov/CoverageFilters.cpp
+++ b/llvm/tools/llvm-cov/CoverageFilters.cpp
@@ -40,13 +40,6 @@ bool NameAllowlistCoverageFilter::matches(
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/llvm/tools/llvm-cov/CoverageFilters.h b/llvm/tools/llvm-cov/CoverageFilters.h
index 3040fe74f7cff..5345b0c87cc27 100644
--- a/llvm/tools/llvm-cov/CoverageFilters.h
+++ b/llvm/tools/llvm-cov/CoverageFilters.h
@@ -79,18 +79,6 @@ class NameAllowlistCoverageFilter : public CoverageFilter {
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:
More information about the llvm-commits
mailing list