mirror of
https://github.com/intel/llvm.git
synced 2026-02-03 10:39:35 +08:00
[llvm-cov] Remove deprecated -name-whitelist after D112816
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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:
|
||||
@@ -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));
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -79,18 +79,6 @@ public:
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user