]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/llvm-cov/CoverageReport.h
Import DTS files from Linux 4.18
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / llvm-cov / CoverageReport.h
1 //===- CoverageReport.h - Code coverage report ---------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This class implements rendering of a code coverage report.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_COV_COVERAGEREPORT_H
15 #define LLVM_COV_COVERAGEREPORT_H
16
17 #include "CoverageFilters.h"
18 #include "CoverageSummaryInfo.h"
19 #include "CoverageViewOptions.h"
20
21 namespace llvm {
22
23 /// \brief Displays the code coverage report.
24 class CoverageReport {
25   const CoverageViewOptions &Options;
26   const coverage::CoverageMapping &Coverage;
27
28   void render(const FileCoverageSummary &File, raw_ostream &OS) const;
29   void render(const FunctionCoverageSummary &Function, const DemangleCache &DC,
30               raw_ostream &OS) const;
31
32 public:
33   CoverageReport(const CoverageViewOptions &Options,
34                  const coverage::CoverageMapping &Coverage)
35       : Options(Options), Coverage(Coverage) {}
36
37   void renderFunctionReports(ArrayRef<std::string> Files,
38                              const DemangleCache &DC, raw_ostream &OS);
39
40   /// Prepare file reports for the files specified in \p Files.
41   static std::vector<FileCoverageSummary>
42   prepareFileReports(const coverage::CoverageMapping &Coverage,
43                      FileCoverageSummary &Totals, ArrayRef<std::string> Files,
44                      const CoverageViewOptions &Options,
45                      const CoverageFilter &Filters = CoverageFiltersMatchAll());
46
47   /// Render file reports for every unique file in the coverage mapping.
48   void renderFileReports(raw_ostream &OS) const;
49
50   /// Render file reports for the files specified in \p Files.
51   void renderFileReports(raw_ostream &OS, ArrayRef<std::string> Files) const;
52
53   /// Render file reports for the files specified in \p Files and the functions
54   /// in \p Filters.
55   void renderFileReports(raw_ostream &OS, ArrayRef<std::string> Files,
56                          const CoverageFiltersMatchAll &Filters) const;
57 };
58
59 } // end namespace llvm
60
61 #endif // LLVM_COV_COVERAGEREPORT_H