1 //===- SourceCoverageViewText.h - A text-based code coverage view ---------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 /// \file This file defines the interface to the text-based coverage renderer.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_COV_SOURCECOVERAGEVIEWTEXT_H
15 #define LLVM_COV_SOURCECOVERAGEVIEWTEXT_H
17 #include "SourceCoverageView.h"
21 using namespace coverage
;
23 /// A coverage printer for text output.
24 class CoveragePrinterText
: public CoveragePrinter
{
26 Expected
<OwnedStream
> createViewFile(StringRef Path
,
27 bool InToplevel
) override
;
29 void closeViewFile(OwnedStream OS
) override
;
31 Error
createIndexFile(ArrayRef
<std::string
> SourceFiles
,
32 const CoverageMapping
&Coverage
,
33 const CoverageFiltersMatchAll
&Filters
) override
;
35 CoveragePrinterText(const CoverageViewOptions
&Opts
)
36 : CoveragePrinter(Opts
) {}
39 /// A code coverage view which supports text-based rendering.
40 class SourceCoverageViewText
: public SourceCoverageView
{
41 void renderViewHeader(raw_ostream
&OS
) override
;
43 void renderViewFooter(raw_ostream
&OS
) override
;
45 void renderSourceName(raw_ostream
&OS
, bool WholeFile
) override
;
47 void renderLinePrefix(raw_ostream
&OS
, unsigned ViewDepth
) override
;
49 void renderLineSuffix(raw_ostream
&OS
, unsigned ViewDepth
) override
;
51 void renderViewDivider(raw_ostream
&OS
, unsigned ViewDepth
) override
;
53 void renderLine(raw_ostream
&OS
, LineRef L
, const LineCoverageStats
&LCS
,
54 unsigned ExpansionCol
, unsigned ViewDepth
) override
;
56 void renderExpansionSite(raw_ostream
&OS
, LineRef L
,
57 const LineCoverageStats
&LCS
, unsigned ExpansionCol
,
58 unsigned ViewDepth
) override
;
60 void renderExpansionView(raw_ostream
&OS
, ExpansionView
&ESV
,
61 unsigned ViewDepth
) override
;
63 void renderInstantiationView(raw_ostream
&OS
, InstantiationView
&ISV
,
64 unsigned ViewDepth
) override
;
66 void renderLineCoverageColumn(raw_ostream
&OS
,
67 const LineCoverageStats
&Line
) override
;
69 void renderLineNumberColumn(raw_ostream
&OS
, unsigned LineNo
) override
;
71 void renderRegionMarkers(raw_ostream
&OS
, const LineCoverageStats
&Line
,
72 unsigned ViewDepth
) override
;
74 void renderTitle(raw_ostream
&OS
, StringRef Title
) override
;
76 void renderTableHeader(raw_ostream
&OS
, unsigned FirstUncoveredLineNo
,
77 unsigned IndentLevel
) override
;
80 SourceCoverageViewText(StringRef SourceName
, const MemoryBuffer
&File
,
81 const CoverageViewOptions
&Options
,
82 CoverageData
&&CoverageInfo
)
83 : SourceCoverageView(SourceName
, File
, Options
, std::move(CoverageInfo
)) {
89 #endif // LLVM_COV_SOURCECOVERAGEVIEWTEXT_H