]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/llvm/tools/llvm-cov/SourceCoverageViewText.h
Merge ^/vendor/llvm-project/release-10.x up to its last change (upstream
[FreeBSD/FreeBSD.git] / contrib / llvm-project / llvm / tools / llvm-cov / SourceCoverageViewText.h
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 code coverage view which supports text-based rendering.
39 class SourceCoverageViewText : public SourceCoverageView {
40   void renderViewHeader(raw_ostream &OS) override;
41
42   void renderViewFooter(raw_ostream &OS) override;
43
44   void renderSourceName(raw_ostream &OS, bool WholeFile) override;
45
46   void renderLinePrefix(raw_ostream &OS, unsigned ViewDepth) override;
47
48   void renderLineSuffix(raw_ostream &OS, unsigned ViewDepth) override;
49
50   void renderViewDivider(raw_ostream &OS, unsigned ViewDepth) override;
51
52   void renderLine(raw_ostream &OS, LineRef L, const LineCoverageStats &LCS,
53                   unsigned ExpansionCol, unsigned ViewDepth) override;
54
55   void renderExpansionSite(raw_ostream &OS, LineRef L,
56                            const LineCoverageStats &LCS, unsigned ExpansionCol,
57                            unsigned ViewDepth) override;
58
59   void renderExpansionView(raw_ostream &OS, ExpansionView &ESV,
60                            unsigned ViewDepth) override;
61
62   void renderInstantiationView(raw_ostream &OS, InstantiationView &ISV,
63                                unsigned ViewDepth) override;
64
65   void renderLineCoverageColumn(raw_ostream &OS,
66                                 const LineCoverageStats &Line) override;
67
68   void renderLineNumberColumn(raw_ostream &OS, unsigned LineNo) override;
69
70   void renderRegionMarkers(raw_ostream &OS, const LineCoverageStats &Line,
71                            unsigned ViewDepth) override;
72
73   void renderTitle(raw_ostream &OS, StringRef Title) override;
74
75   void renderTableHeader(raw_ostream &OS, unsigned FirstUncoveredLineNo,
76                          unsigned IndentLevel) override;
77
78 public:
79   SourceCoverageViewText(StringRef SourceName, const MemoryBuffer &File,
80                          const CoverageViewOptions &Options,
81                          CoverageData &&CoverageInfo)
82       : SourceCoverageView(SourceName, File, Options, std::move(CoverageInfo)) {
83   }
84 };
85
86 } // namespace llvm
87
88 #endif // LLVM_COV_SOURCECOVERAGEVIEWTEXT_H