[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / llvm / tools / llvm-cov / SourceCoverageViewText.h
blobb2be06039f957248fc8a6e9a6a2fa016dcc53910
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 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_COV_SOURCECOVERAGEVIEWTEXT_H
14 #define LLVM_COV_SOURCECOVERAGEVIEWTEXT_H
16 #include "SourceCoverageView.h"
18 namespace llvm {
20 using namespace coverage;
22 /// A coverage printer for text output.
23 class CoveragePrinterText : public CoveragePrinter {
24 public:
25 Expected<OwnedStream> createViewFile(StringRef Path,
26 bool InToplevel) override;
28 void closeViewFile(OwnedStream OS) override;
30 Error createIndexFile(ArrayRef<std::string> SourceFiles,
31 const CoverageMapping &Coverage,
32 const CoverageFiltersMatchAll &Filters) override;
34 CoveragePrinterText(const CoverageViewOptions &Opts)
35 : CoveragePrinter(Opts) {}
38 /// A code coverage view which supports text-based rendering.
39 class SourceCoverageViewText : public SourceCoverageView {
40 void renderViewHeader(raw_ostream &OS) override;
42 void renderViewFooter(raw_ostream &OS) override;
44 void renderSourceName(raw_ostream &OS, bool WholeFile) override;
46 void renderLinePrefix(raw_ostream &OS, unsigned ViewDepth) override;
48 void renderLineSuffix(raw_ostream &OS, unsigned ViewDepth) override;
50 void renderViewDivider(raw_ostream &OS, unsigned ViewDepth) override;
52 void renderLine(raw_ostream &OS, LineRef L, const LineCoverageStats &LCS,
53 unsigned ExpansionCol, unsigned ViewDepth) override;
55 void renderExpansionSite(raw_ostream &OS, LineRef L,
56 const LineCoverageStats &LCS, unsigned ExpansionCol,
57 unsigned ViewDepth) override;
59 void renderExpansionView(raw_ostream &OS, ExpansionView &ESV,
60 unsigned ViewDepth) override;
62 void renderBranchView(raw_ostream &OS, BranchView &BRV,
63 unsigned ViewDepth) override;
65 void renderInstantiationView(raw_ostream &OS, InstantiationView &ISV,
66 unsigned ViewDepth) override;
68 void renderLineCoverageColumn(raw_ostream &OS,
69 const LineCoverageStats &Line) override;
71 void renderLineNumberColumn(raw_ostream &OS, unsigned LineNo) override;
73 void renderRegionMarkers(raw_ostream &OS, const LineCoverageStats &Line,
74 unsigned ViewDepth) override;
76 void renderTitle(raw_ostream &OS, StringRef Title) override;
78 void renderTableHeader(raw_ostream &OS, unsigned FirstUncoveredLineNo,
79 unsigned IndentLevel) override;
81 public:
82 SourceCoverageViewText(StringRef SourceName, const MemoryBuffer &File,
83 const CoverageViewOptions &Options,
84 CoverageData &&CoverageInfo)
85 : SourceCoverageView(SourceName, File, Options, std::move(CoverageInfo)) {
89 } // namespace llvm
91 #endif // LLVM_COV_SOURCECOVERAGEVIEWTEXT_H