aboutsummaryrefslogtreecommitdiffstats
path: root/tools/llvm-cov/CoverageReport.h
blob: 7ec3df90b8f92d32dc10cceef06bfbbec75896fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//===- CoverageReport.h - Code coverage report ---------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This class implements rendering of a code coverage report.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_COV_COVERAGEREPORT_H
#define LLVM_COV_COVERAGEREPORT_H

#include "CoverageSummaryInfo.h"
#include "CoverageViewOptions.h"

namespace llvm {

/// \brief Displays the code coverage report.
class CoverageReport {
  const CoverageViewOptions &Options;
  std::unique_ptr<coverage::CoverageMapping> Coverage;

  void render(const FileCoverageSummary &File, raw_ostream &OS);
  void render(const FunctionCoverageSummary &Function, raw_ostream &OS);

public:
  CoverageReport(const CoverageViewOptions &Options,
                 std::unique_ptr<coverage::CoverageMapping> Coverage)
      : Options(Options), Coverage(std::move(Coverage)) {}

  void renderFunctionReports(ArrayRef<std::string> Files, raw_ostream &OS);

  void renderFileReports(raw_ostream &OS);
};
}

#endif // LLVM_COV_COVERAGEREPORT_H