Coverage Report

Created: 2017-09-21 03:39

/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) override;
33
34
  CoveragePrinterHTML(const CoverageViewOptions &Opts)
35
17
      : CoveragePrinter(Opts) {}
36
37
private:
38
  void emitFileSummary(raw_ostream &OS, StringRef SF,
39
                       const FileCoverageSummary &FCS,
40
                       bool IsTotals = false) const;
41
  std::string buildLinkToFile(StringRef SF,
42
                              const FileCoverageSummary &FCS) const;
43
};
44
45
/// \brief A code coverage view which supports html-based rendering.
46
class SourceCoverageViewHTML : public SourceCoverageView {
47
  void renderViewHeader(raw_ostream &OS) override;
48
49
  void renderViewFooter(raw_ostream &OS) override;
50
51
  void renderSourceName(raw_ostream &OS, bool WholeFile) override;
52
53
  void renderLinePrefix(raw_ostream &OS, unsigned ViewDepth) override;
54
55
  void renderLineSuffix(raw_ostream &OS, unsigned ViewDepth) override;
56
57
  void renderViewDivider(raw_ostream &OS, unsigned ViewDepth) override;
58
59
  void renderLine(raw_ostream &OS, LineRef L,
60
                  const coverage::CoverageSegment *WrappedSegment,
61
                  CoverageSegmentArray Segments, unsigned ExpansionCol,
62
                  unsigned ViewDepth) override;
63
64
  void renderExpansionSite(raw_ostream &OS, LineRef L,
65
                           const coverage::CoverageSegment *WrappedSegment,
66
                           CoverageSegmentArray Segments, 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, CoverageSegmentArray Segments,
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
21
      : SourceCoverageView(SourceName, File, Options, std::move(CoverageInfo)) {
93
21
  }
94
};
95
96
} // namespace llvm
97
98
#endif // LLVM_COV_SOURCECOVERAGEVIEWHTML_H