1 //===- SourceCoverageViewHTML.h - A html 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 html coverage renderer.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_COV_SOURCECOVERAGEVIEWHTML_H
15 #define LLVM_COV_SOURCECOVERAGEVIEWHTML_H
17 #include "SourceCoverageView.h"
21 using namespace coverage
;
23 struct FileCoverageSummary
;
25 /// A coverage printer for html output.
26 class CoveragePrinterHTML
: public CoveragePrinter
{
28 Expected
<OwnedStream
> createViewFile(StringRef Path
,
29 bool InToplevel
) override
;
31 void closeViewFile(OwnedStream OS
) override
;
33 Error
createIndexFile(ArrayRef
<std::string
> SourceFiles
,
34 const coverage::CoverageMapping
&Coverage
,
35 const CoverageFiltersMatchAll
&Filters
) override
;
37 CoveragePrinterHTML(const CoverageViewOptions
&Opts
)
38 : CoveragePrinter(Opts
) {}
41 void emitFileSummary(raw_ostream
&OS
, StringRef SF
,
42 const FileCoverageSummary
&FCS
,
43 bool IsTotals
= false) const;
44 std::string
buildLinkToFile(StringRef SF
,
45 const FileCoverageSummary
&FCS
) const;
48 /// A code coverage view which supports html-based rendering.
49 class SourceCoverageViewHTML
: public SourceCoverageView
{
50 void renderViewHeader(raw_ostream
&OS
) override
;
52 void renderViewFooter(raw_ostream
&OS
) override
;
54 void renderSourceName(raw_ostream
&OS
, bool WholeFile
) override
;
56 void renderLinePrefix(raw_ostream
&OS
, unsigned ViewDepth
) override
;
58 void renderLineSuffix(raw_ostream
&OS
, unsigned ViewDepth
) override
;
60 void renderViewDivider(raw_ostream
&OS
, unsigned ViewDepth
) override
;
62 void renderLine(raw_ostream
&OS
, LineRef L
, const LineCoverageStats
&LCS
,
63 unsigned ExpansionCol
, unsigned ViewDepth
) override
;
65 void renderExpansionSite(raw_ostream
&OS
, LineRef L
,
66 const LineCoverageStats
&LCS
, unsigned ExpansionCol
,
67 unsigned ViewDepth
) override
;
69 void renderExpansionView(raw_ostream
&OS
, ExpansionView
&ESV
,
70 unsigned ViewDepth
) override
;
72 void renderInstantiationView(raw_ostream
&OS
, InstantiationView
&ISV
,
73 unsigned ViewDepth
) override
;
75 void renderLineCoverageColumn(raw_ostream
&OS
,
76 const LineCoverageStats
&Line
) override
;
78 void renderLineNumberColumn(raw_ostream
&OS
, unsigned LineNo
) override
;
80 void renderRegionMarkers(raw_ostream
&OS
, const LineCoverageStats
&Line
,
81 unsigned ViewDepth
) override
;
83 void renderTitle(raw_ostream
&OS
, StringRef Title
) override
;
85 void renderTableHeader(raw_ostream
&OS
, unsigned FirstUncoveredLineNo
,
86 unsigned IndentLevel
) override
;
89 SourceCoverageViewHTML(StringRef SourceName
, const MemoryBuffer
&File
,
90 const CoverageViewOptions
&Options
,
91 coverage::CoverageData
&&CoverageInfo
)
92 : SourceCoverageView(SourceName
, File
, Options
, std::move(CoverageInfo
)) {
98 #endif // LLVM_COV_SOURCECOVERAGEVIEWHTML_H