Coverage Report

Created: 2017-09-21 03:39

/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) override;
31
32
  CoveragePrinterText(const CoverageViewOptions &Opts)
33
42
      : CoveragePrinter(Opts) {}
34
};
35
36
/// \brief A code coverage view which supports text-based rendering.
37
class SourceCoverageViewText : public SourceCoverageView {
38
  void renderViewHeader(raw_ostream &OS) override;
39
40
  void renderViewFooter(raw_ostream &OS) override;
41
42
  void renderSourceName(raw_ostream &OS, bool WholeFile) override;
43
44
  void renderLinePrefix(raw_ostream &OS, unsigned ViewDepth) override;
45
46
  void renderLineSuffix(raw_ostream &OS, unsigned ViewDepth) override;
47
48
  void renderViewDivider(raw_ostream &OS, unsigned ViewDepth) override;
49
50
  void renderLine(raw_ostream &OS, LineRef L,
51
                  const coverage::CoverageSegment *WrappedSegment,
52
                  CoverageSegmentArray Segments, unsigned ExpansionCol,
53
                  unsigned ViewDepth) override;
54
55
  void renderExpansionSite(raw_ostream &OS, LineRef L,
56
                           const coverage::CoverageSegment *WrappedSegment,
57
                           CoverageSegmentArray Segments, unsigned ExpansionCol,
58
                           unsigned ViewDepth) override;
59
60
  void renderExpansionView(raw_ostream &OS, ExpansionView &ESV,
61
                           unsigned ViewDepth) override;
62
63
  void renderInstantiationView(raw_ostream &OS, InstantiationView &ISV,
64
                               unsigned ViewDepth) override;
65
66
  void renderLineCoverageColumn(raw_ostream &OS,
67
                                const LineCoverageStats &Line) override;
68
69
  void renderLineNumberColumn(raw_ostream &OS, unsigned LineNo) override;
70
71
  void renderRegionMarkers(raw_ostream &OS, CoverageSegmentArray Segments,
72
                           unsigned ViewDepth) override;
73
74
  void renderTitle(raw_ostream &OS, StringRef Title) override;
75
76
  void renderTableHeader(raw_ostream &OS, unsigned FirstUncoveredLineNo,
77
                         unsigned IndentLevel) override;
78
79
public:
80
  SourceCoverageViewText(StringRef SourceName, const MemoryBuffer &File,
81
                         const CoverageViewOptions &Options,
82
                         coverage::CoverageData &&CoverageInfo)
83
52
      : SourceCoverageView(SourceName, File, Options, std::move(CoverageInfo)) {
84
52
  }
85
};
86
87
} // namespace llvm
88
89
#endif // LLVM_COV_SOURCECOVERAGEVIEWTEXT_H