Coverage Report

Created: 2018-01-17 21:32

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/llvm-cov/SourceCoverageViewHTML.h
Line
Count
Source
1
//===- SourceCoverageViewHTML.h - A html code coverage view ---------------===//
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
/// \file This file defines the interface to the html coverage renderer.
11
///
12
//===----------------------------------------------------------------------===//
13
14
#ifndef LLVM_COV_SOURCECOVERAGEVIEWHTML_H
15
#define LLVM_COV_SOURCECOVERAGEVIEWHTML_H
16
17
#include "SourceCoverageView.h"
18
19
namespace llvm {
20
21
using namespace coverage;
22
23
struct FileCoverageSummary;
24
25
/// \brief A coverage printer for html output.
26
class CoveragePrinterHTML : public CoveragePrinter {
27
public:
28
  Expected<OwnedStream> createViewFile(StringRef Path,
29
                                       bool InToplevel) override;
30
31
  void closeViewFile(OwnedStream OS) override;
32
33
  Error createIndexFile(ArrayRef<std::string> SourceFiles,
34
                        const coverage::CoverageMapping &Coverage,
35
                        const CoverageFiltersMatchAll &Filters) override;
36
37
  CoveragePrinterHTML(const CoverageViewOptions &Opts)
38
11
      : CoveragePrinter(Opts) {}
39
40
private:
41
  void emitFileSummary(raw_ostream &OS, StringRef SF,
42
                       const FileCoverageSummary &FCS,
43
                       bool IsTotals = false) const;
44
  std::string buildLinkToFile(StringRef SF,
45
                              const FileCoverageSummary &FCS) const;
46
};
47
48
/// \brief A code coverage view which supports html-based rendering.
49
class SourceCoverageViewHTML : public SourceCoverageView {
50
  void renderViewHeader(raw_ostream &OS) override;
51
52
  void renderViewFooter(raw_ostream &OS) override;
53
54
  void renderSourceName(raw_ostream &OS, bool WholeFile) override;
55
56
  void renderLinePrefix(raw_ostream &OS, unsigned ViewDepth) override;
57
58
  void renderLineSuffix(raw_ostream &OS, unsigned ViewDepth) override;
59
60
  void renderViewDivider(raw_ostream &OS, unsigned ViewDepth) override;
61
62
  void renderLine(raw_ostream &OS, LineRef L, const LineCoverageStats &LCS,
63
                  unsigned ExpansionCol, unsigned ViewDepth) override;
64
65
  void renderExpansionSite(raw_ostream &OS, LineRef L,
66
                           const LineCoverageStats &LCS, unsigned ExpansionCol,
67
                           unsigned ViewDepth) override;
68
69
  void renderExpansionView(raw_ostream &OS, ExpansionView &ESV,
70
                           unsigned ViewDepth) override;
71
72
  void renderInstantiationView(raw_ostream &OS, InstantiationView &ISV,
73
                               unsigned ViewDepth) override;
74
75
  void renderLineCoverageColumn(raw_ostream &OS,
76
                                const LineCoverageStats &Line) override;
77
78
  void renderLineNumberColumn(raw_ostream &OS, unsigned LineNo) override;
79
80
  void renderRegionMarkers(raw_ostream &OS, const LineCoverageStats &Line,
81
                           unsigned ViewDepth) override;
82
83
  void renderTitle(raw_ostream &OS, StringRef Title) override;
84
85
  void renderTableHeader(raw_ostream &OS, unsigned FirstUncoveredLineNo,
86
                         unsigned IndentLevel) override;
87
88
public:
89
  SourceCoverageViewHTML(StringRef SourceName, const MemoryBuffer &File,
90
                         const CoverageViewOptions &Options,
91
                         coverage::CoverageData &&CoverageInfo)
92
53
      : SourceCoverageView(SourceName, File, Options, std::move(CoverageInfo)) {
93
53
  }
94
};
95
96
} // namespace llvm
97
98
#endif // LLVM_COV_SOURCECOVERAGEVIEWHTML_H