Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/contrib/llvm-project/llvm/tools/llvm-cov/SourceCoverageViewText.h
35231 views
1
//===- SourceCoverageViewText.h - A text-based code coverage view ---------===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
///
9
/// \file This file defines the interface to the text-based coverage renderer.
10
///
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_COV_SOURCECOVERAGEVIEWTEXT_H
14
#define LLVM_COV_SOURCECOVERAGEVIEWTEXT_H
15
16
#include "SourceCoverageView.h"
17
18
namespace llvm {
19
20
using namespace coverage;
21
22
/// A coverage printer for text output.
23
class CoveragePrinterText : public CoveragePrinter {
24
public:
25
Expected<OwnedStream> createViewFile(StringRef Path,
26
bool InToplevel) override;
27
28
void closeViewFile(OwnedStream OS) override;
29
30
Error createIndexFile(ArrayRef<std::string> SourceFiles,
31
const CoverageMapping &Coverage,
32
const CoverageFiltersMatchAll &Filters) override;
33
34
CoveragePrinterText(const CoverageViewOptions &Opts)
35
: CoveragePrinter(Opts) {}
36
};
37
38
/// A coverage printer for text output, but generates index files in every
39
/// subdirectory to show a hierarchical view. The implementation is similar
40
/// to CoveragePrinterHTMLDirectory. So please refer to that for more comments.
41
class CoveragePrinterTextDirectory : public CoveragePrinterText {
42
public:
43
using CoveragePrinterText::CoveragePrinterText;
44
45
Error createIndexFile(ArrayRef<std::string> SourceFiles,
46
const CoverageMapping &Coverage,
47
const CoverageFiltersMatchAll &Filters) override;
48
49
private:
50
struct Reporter;
51
};
52
53
/// A code coverage view which supports text-based rendering.
54
class SourceCoverageViewText : public SourceCoverageView {
55
void renderViewHeader(raw_ostream &OS) override;
56
57
void renderViewFooter(raw_ostream &OS) override;
58
59
void renderSourceName(raw_ostream &OS, bool WholeFile) override;
60
61
void renderLinePrefix(raw_ostream &OS, unsigned ViewDepth) override;
62
63
void renderLineSuffix(raw_ostream &OS, unsigned ViewDepth) override;
64
65
void renderViewDivider(raw_ostream &OS, unsigned ViewDepth) override;
66
67
void renderLine(raw_ostream &OS, LineRef L, const LineCoverageStats &LCS,
68
unsigned ExpansionCol, unsigned ViewDepth) override;
69
70
void renderExpansionSite(raw_ostream &OS, LineRef L,
71
const LineCoverageStats &LCS, unsigned ExpansionCol,
72
unsigned ViewDepth) override;
73
74
void renderExpansionView(raw_ostream &OS, ExpansionView &ESV,
75
unsigned ViewDepth) override;
76
77
void renderBranchView(raw_ostream &OS, BranchView &BRV,
78
unsigned ViewDepth) override;
79
80
void renderMCDCView(raw_ostream &OS, MCDCView &BRV,
81
unsigned ViewDepth) override;
82
83
void renderInstantiationView(raw_ostream &OS, InstantiationView &ISV,
84
unsigned ViewDepth) override;
85
86
void renderLineCoverageColumn(raw_ostream &OS,
87
const LineCoverageStats &Line) override;
88
89
void renderLineNumberColumn(raw_ostream &OS, unsigned LineNo) override;
90
91
void renderRegionMarkers(raw_ostream &OS, const LineCoverageStats &Line,
92
unsigned ViewDepth) override;
93
94
void renderTitle(raw_ostream &OS, StringRef Title) override;
95
96
void renderTableHeader(raw_ostream &OS, unsigned IndentLevel) override;
97
98
public:
99
SourceCoverageViewText(StringRef SourceName, const MemoryBuffer &File,
100
const CoverageViewOptions &Options,
101
CoverageData &&CoverageInfo)
102
: SourceCoverageView(SourceName, File, Options, std::move(CoverageInfo)) {
103
}
104
};
105
106
} // namespace llvm
107
108
#endif // LLVM_COV_SOURCECOVERAGEVIEWTEXT_H
109
110