blob: 071be2e21594c6f65f783df571e91596c31944f7 [file] [log] [blame]
Alex Lorenze82d89c2014-08-22 22:56:03 +00001//===- 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
Justin Bognerf91bc6c2015-02-14 02:01:24 +000017#include "CoverageSummaryInfo.h"
Chandler Carruthd9903882015-01-14 11:23:27 +000018#include "CoverageViewOptions.h"
Alex Lorenze82d89c2014-08-22 22:56:03 +000019
20namespace llvm {
21
22/// \brief Displays the code coverage report.
23class CoverageReport {
24 const CoverageViewOptions &Options;
Vedant Kumar702bb9d2016-09-06 22:45:57 +000025 const coverage::CoverageMapping &Coverage;
Alex Lorenze82d89c2014-08-22 22:56:03 +000026
Vedant Kumar627887b62016-09-09 01:32:49 +000027 void render(const FileCoverageSummary &File, raw_ostream &OS) const;
Vedant Kumarf2b067c2017-02-05 20:11:03 +000028 void render(const FunctionCoverageSummary &Function, const DemangleCache &DC,
29 raw_ostream &OS) const;
Alex Lorenze82d89c2014-08-22 22:56:03 +000030
31public:
Justin Bognerf91bc6c2015-02-14 02:01:24 +000032 CoverageReport(const CoverageViewOptions &Options,
Vedant Kumar702bb9d2016-09-06 22:45:57 +000033 const coverage::CoverageMapping &Coverage)
34 : Options(Options), Coverage(Coverage) {}
Alex Lorenze82d89c2014-08-22 22:56:03 +000035
Vedant Kumarf2b067c2017-02-05 20:11:03 +000036 void renderFunctionReports(ArrayRef<std::string> Files,
37 const DemangleCache &DC, raw_ostream &OS);
Alex Lorenze82d89c2014-08-22 22:56:03 +000038
Vedant Kumar627887b62016-09-09 01:32:49 +000039 /// Prepare file reports for the files specified in \p Files.
Vedant Kumar9cbf80a2016-09-19 00:38:25 +000040 static std::vector<FileCoverageSummary>
41 prepareFileReports(const coverage::CoverageMapping &Coverage,
Vedant Kumarbc647982016-09-23 18:57:32 +000042 FileCoverageSummary &Totals, ArrayRef<std::string> Files);
Vedant Kumar627887b62016-09-09 01:32:49 +000043
44 /// Render file reports for every unique file in the coverage mapping.
45 void renderFileReports(raw_ostream &OS) const;
46
47 /// Render file reports for the files specified in \p Files.
Vedant Kumarbc647982016-09-23 18:57:32 +000048 void renderFileReports(raw_ostream &OS, ArrayRef<std::string> Files) const;
Alex Lorenze82d89c2014-08-22 22:56:03 +000049};
Vedant Kumar702bb9d2016-09-06 22:45:57 +000050
51} // end namespace llvm
Alex Lorenze82d89c2014-08-22 22:56:03 +000052
53#endif // LLVM_COV_COVERAGEREPORT_H