llvm/llvm/tools/llvm-cov/CoverageFilters.h

//===- CoverageFilters.h - Function coverage mapping filters --------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// These classes provide filtering for function coverage mapping records.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_COV_COVERAGEFILTERS_H
#define LLVM_COV_COVERAGEFILTERS_H

#include "llvm/ADT/StringRef.h"
#include <memory>
#include <vector>

namespace llvm {
class SpecialCaseList;

namespace coverage {
class CoverageMapping;
struct FunctionRecord;
} // namespace coverage

/// Matches specific functions that pass the requirement of this filter.
class CoverageFilter {};

/// Matches functions that contain a specific string in their name.
class NameCoverageFilter : public CoverageFilter {};

/// Matches functions whose name matches a certain regular expression.
class NameRegexCoverageFilter : public CoverageFilter {};

/// Matches functions whose name appears in a SpecialCaseList in the
/// allowlist_fun section.
class NameAllowlistCoverageFilter : public CoverageFilter {};

/// Matches numbers that pass a certain threshold.
template <typename T> class StatisticThresholdFilter {};

/// Matches functions whose region coverage percentage
/// is above/below a certain percentage.
class RegionCoverageFilter : public CoverageFilter,
                             public StatisticThresholdFilter<double> {};

/// Matches functions whose line coverage percentage
/// is above/below a certain percentage.
class LineCoverageFilter : public CoverageFilter,
                           public StatisticThresholdFilter<double> {};

/// A collection of filters.
/// Matches functions that match any filters contained
/// in an instance of this class.
class CoverageFilters : public CoverageFilter {};

/// A collection of filters.
/// Matches functions that match all of the filters contained
/// in an instance of this class.
class CoverageFiltersMatchAll : public CoverageFilters {};

} // namespace llvm

#endif // LLVM_COV_COVERAGEFILTERS_H