Coverage Report

Created: 2018-10-23 15:26

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/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
using namespace coverage;
22
23
/// A coverage printer for text output.
24
class CoveragePrinterText : 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 CoverageMapping &Coverage,
33
                        const CoverageFiltersMatchAll &Filters) override;
34
35
  CoveragePrinterText(const CoverageViewOptions &Opts)
36
52
      : CoveragePrinter(Opts) {}
37
};
38
39
/// A code coverage view which supports text-based rendering.
40
class SourceCoverageViewText : public SourceCoverageView {
41
  void renderViewHeader(raw_ostream &OS) override;
42
43
  void renderViewFooter(raw_ostream &OS) override;
44
45
  void renderSourceName(raw_ostream &OS, bool WholeFile) override;
46
47
  void renderLinePrefix(raw_ostream &OS, unsigned ViewDepth) override;
48
49
  void renderLineSuffix(raw_ostream &OS, unsigned ViewDepth) override;
50
51
  void renderViewDivider(raw_ostream &OS, unsigned ViewDepth) override;
52
53
  void renderLine(raw_ostream &OS, LineRef L, const LineCoverageStats &LCS,
54
                  unsigned ExpansionCol, unsigned ViewDepth) override;
55
56
  void renderExpansionSite(raw_ostream &OS, LineRef L,
57
                           const LineCoverageStats &LCS, 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, const LineCoverageStats &Line,
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
                         CoverageData &&CoverageInfo)
83
111
      : SourceCoverageView(SourceName, File, Options, std::move(CoverageInfo)) {
84
111
  }
85
};
86
87
} // namespace llvm
88
89
#endif // LLVM_COV_SOURCECOVERAGEVIEWTEXT_H