1 //===- CoverageReport.h - Code coverage report ----------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This class implements rendering of a code coverage report.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_COV_COVERAGEREPORT_H
15 #define LLVM_COV_COVERAGEREPORT_H
17 #include "CoverageFilters.h"
18 #include "CoverageSummaryInfo.h"
19 #include "CoverageViewOptions.h"
23 /// Displays the code coverage report.
24 class CoverageReport
{
25 const CoverageViewOptions
&Options
;
26 const coverage::CoverageMapping
&Coverage
;
28 void render(const FileCoverageSummary
&File
, raw_ostream
&OS
) const;
29 void render(const FunctionCoverageSummary
&Function
, const DemangleCache
&DC
,
30 raw_ostream
&OS
) const;
33 CoverageReport(const CoverageViewOptions
&Options
,
34 const coverage::CoverageMapping
&Coverage
)
35 : Options(Options
), Coverage(Coverage
) {}
37 void renderFunctionReports(ArrayRef
<std::string
> Files
,
38 const DemangleCache
&DC
, raw_ostream
&OS
);
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());
48 prepareSingleFileReport(const StringRef Filename
,
49 const coverage::CoverageMapping
*Coverage
,
50 const CoverageViewOptions
&Options
,
52 FileCoverageSummary
*FileReport
,
53 const CoverageFilter
*Filters
);
55 /// Render file reports for every unique file in the coverage mapping.
56 void renderFileReports(raw_ostream
&OS
,
57 const CoverageFilters
&IgnoreFilenameFilters
) const;
59 /// Render file reports for the files specified in \p Files.
60 void renderFileReports(raw_ostream
&OS
, ArrayRef
<std::string
> Files
) const;
62 /// Render file reports for the files specified in \p Files and the functions
64 void renderFileReports(raw_ostream
&OS
, ArrayRef
<std::string
> Files
,
65 const CoverageFiltersMatchAll
&Filters
) const;
68 } // end namespace llvm
70 #endif // LLVM_COV_COVERAGEREPORT_H