blob: 242dc7fe7ba572aa35ba9b79b136f92777d7a5e4 [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 Kumar72c3a112017-09-08 18:44:49 +000042 FileCoverageSummary &Totals, ArrayRef<std::string> Files,
Sean Eveson1439fa62017-09-27 16:20:07 +000043 const CoverageViewOptions &Options);
Vedant Kumar627887b62016-09-09 01:32:49 +000044
45 /// Render file reports for every unique file in the coverage mapping.
46 void renderFileReports(raw_ostream &OS) const;
47
Sean Eveson1439fa62017-09-27 16:20:07 +000048 /// Render file reports for the files specified in \p Files.
49 void renderFileReports(raw_ostream &OS, ArrayRef<std::string> Files) const;
Alex Lorenze82d89c2014-08-22 22:56:03 +000050};
Vedant Kumar702bb9d2016-09-06 22:45:57 +000051
52} // end namespace llvm
Alex Lorenze82d89c2014-08-22 22:56:03 +000053
54#endif // LLVM_COV_COVERAGEREPORT_H