Coverage Report

Created: 2017-10-03 07:32

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