[ThinLTO] Add code comment. NFC
[llvm-core.git] / tools / llvm-cov / CoverageReport.h
blobf9a092f510b504616c03c5a6030fad8582696be8
1 //===- CoverageReport.h - Code coverage report ----------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This class implements rendering of a code coverage report.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_COV_COVERAGEREPORT_H
14 #define LLVM_COV_COVERAGEREPORT_H
16 #include "CoverageFilters.h"
17 #include "CoverageSummaryInfo.h"
18 #include "CoverageViewOptions.h"
20 namespace llvm {
22 /// Displays the code coverage report.
23 class CoverageReport {
24 const CoverageViewOptions &Options;
25 const coverage::CoverageMapping &Coverage;
27 void render(const FileCoverageSummary &File, raw_ostream &OS) const;
28 void render(const FunctionCoverageSummary &Function, const DemangleCache &DC,
29 raw_ostream &OS) const;
31 public:
32 CoverageReport(const CoverageViewOptions &Options,
33 const coverage::CoverageMapping &Coverage)
34 : Options(Options), Coverage(Coverage) {}
36 void renderFunctionReports(ArrayRef<std::string> Files,
37 const DemangleCache &DC, raw_ostream &OS);
39 /// Prepare file reports for the files specified in \p Files.
40 static std::vector<FileCoverageSummary>
41 prepareFileReports(const coverage::CoverageMapping &Coverage,
42 FileCoverageSummary &Totals, ArrayRef<std::string> Files,
43 const CoverageViewOptions &Options,
44 const CoverageFilter &Filters = CoverageFiltersMatchAll());
46 static void
47 prepareSingleFileReport(const StringRef Filename,
48 const coverage::CoverageMapping *Coverage,
49 const CoverageViewOptions &Options,
50 const unsigned LCP,
51 FileCoverageSummary *FileReport,
52 const CoverageFilter *Filters);
54 /// Render file reports for every unique file in the coverage mapping.
55 void renderFileReports(raw_ostream &OS,
56 const CoverageFilters &IgnoreFilenameFilters) const;
58 /// Render file reports for the files specified in \p Files.
59 void renderFileReports(raw_ostream &OS, ArrayRef<std::string> Files) const;
61 /// Render file reports for the files specified in \p Files and the functions
62 /// in \p Filters.
63 void renderFileReports(raw_ostream &OS, ArrayRef<std::string> Files,
64 const CoverageFiltersMatchAll &Filters) const;
67 } // end namespace llvm
69 #endif // LLVM_COV_COVERAGEREPORT_H