Coverage Report

Created: 2017-10-03 07:32

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