using namespace llvm;
-bool NameCoverageFilter::matches(const coverage::CoverageMapping &,
- const coverage::FunctionRecord &Function) {
+bool NameCoverageFilter::matches(
+ const coverage::CoverageMapping &,
+ const coverage::FunctionRecord &Function) const {
StringRef FuncName = Function.Name;
return FuncName.find(Name) != StringRef::npos;
}
bool NameRegexCoverageFilter::matches(
const coverage::CoverageMapping &,
- const coverage::FunctionRecord &Function) {
+ const coverage::FunctionRecord &Function) const {
return llvm::Regex(Regex).match(Function.Name);
}
bool NameWhitelistCoverageFilter::matches(
const coverage::CoverageMapping &,
- const coverage::FunctionRecord &Function) {
+ const coverage::FunctionRecord &Function) const {
return Whitelist.inSection("llvmcov", "whitelist_fun", Function.Name);
}
-bool RegionCoverageFilter::matches(const coverage::CoverageMapping &CM,
- const coverage::FunctionRecord &Function) {
+bool RegionCoverageFilter::matches(
+ const coverage::CoverageMapping &CM,
+ const coverage::FunctionRecord &Function) const {
return PassesThreshold(FunctionCoverageSummary::get(CM, Function)
.RegionCoverage.getPercentCovered());
}
-bool LineCoverageFilter::matches(const coverage::CoverageMapping &CM,
- const coverage::FunctionRecord &Function) {
+bool LineCoverageFilter::matches(
+ const coverage::CoverageMapping &CM,
+ const coverage::FunctionRecord &Function) const {
return PassesThreshold(FunctionCoverageSummary::get(CM, Function)
.LineCoverage.getPercentCovered());
}
}
bool CoverageFilters::matches(const coverage::CoverageMapping &CM,
- const coverage::FunctionRecord &Function) {
+ const coverage::FunctionRecord &Function) const {
for (const auto &Filter : Filters) {
if (Filter->matches(CM, Function))
return true;
bool CoverageFiltersMatchAll::matches(
const coverage::CoverageMapping &CM,
- const coverage::FunctionRecord &Function) {
+ const coverage::FunctionRecord &Function) const {
for (const auto &Filter : Filters) {
if (!Filter->matches(CM, Function))
return false;
/// \brief Return true if the function passes the requirements of this filter.
virtual bool matches(const coverage::CoverageMapping &CM,
- const coverage::FunctionRecord &Function) {
+ const coverage::FunctionRecord &Function) const {
return true;
}
};
NameCoverageFilter(StringRef Name) : Name(Name) {}
bool matches(const coverage::CoverageMapping &CM,
- const coverage::FunctionRecord &Function) override;
+ const coverage::FunctionRecord &Function) const override;
};
/// \brief Matches functions whose name matches a certain regular expression.
NameRegexCoverageFilter(StringRef Regex) : Regex(Regex) {}
bool matches(const coverage::CoverageMapping &CM,
- const coverage::FunctionRecord &Function) override;
+ const coverage::FunctionRecord &Function) const override;
};
/// \brief Matches functions whose name appears in a SpecialCaseList in the
: Whitelist(Whitelist) {}
bool matches(const coverage::CoverageMapping &CM,
- const coverage::FunctionRecord &Function) override;
+ const coverage::FunctionRecord &Function) const override;
};
/// \brief Matches numbers that pass a certain threshold.
: StatisticThresholdFilter(Op, Threshold) {}
bool matches(const coverage::CoverageMapping &CM,
- const coverage::FunctionRecord &Function) override;
+ const coverage::FunctionRecord &Function) const override;
};
/// \brief Matches functions whose line coverage percentage
: StatisticThresholdFilter(Op, Threshold) {}
bool matches(const coverage::CoverageMapping &CM,
- const coverage::FunctionRecord &Function) override;
+ const coverage::FunctionRecord &Function) const override;
};
/// \brief A collection of filters.
bool empty() const { return Filters.empty(); }
bool matches(const coverage::CoverageMapping &CM,
- const coverage::FunctionRecord &Function) override;
+ const coverage::FunctionRecord &Function) const override;
};
/// \brief A collection of filters.
class CoverageFiltersMatchAll : public CoverageFilters {
public:
bool matches(const coverage::CoverageMapping &CM,
- const coverage::FunctionRecord &Function) override;
+ const coverage::FunctionRecord &Function) const override;
};
} // namespace llvm