1 //===- CoverageReport.h - Code coverage report ----------------------------===//
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
7 //===----------------------------------------------------------------------===//
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"
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;
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());
47 prepareSingleFileReport(const StringRef Filename
,
48 const coverage::CoverageMapping
*Coverage
,
49 const CoverageViewOptions
&Options
,
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
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