[Alignment][NFC] Make VectorUtils uas llvm::Align
[llvm-complete.git] / tools / llvm-cov / SourceCoverageViewHTML.h
blob9834040008a650dc814da8737d235429999dcd9a
1 //===- SourceCoverageViewHTML.h - A html 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 html coverage renderer.
10 ///
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_COV_SOURCECOVERAGEVIEWHTML_H
14 #define LLVM_COV_SOURCECOVERAGEVIEWHTML_H
16 #include "SourceCoverageView.h"
18 namespace llvm {
20 using namespace coverage;
22 struct FileCoverageSummary;
24 /// A coverage printer for html output.
25 class CoveragePrinterHTML : public CoveragePrinter {
26 public:
27 Expected<OwnedStream> createViewFile(StringRef Path,
28 bool InToplevel) override;
30 void closeViewFile(OwnedStream OS) override;
32 Error createIndexFile(ArrayRef<std::string> SourceFiles,
33 const coverage::CoverageMapping &Coverage,
34 const CoverageFiltersMatchAll &Filters) override;
36 CoveragePrinterHTML(const CoverageViewOptions &Opts)
37 : CoveragePrinter(Opts) {}
39 private:
40 void emitFileSummary(raw_ostream &OS, StringRef SF,
41 const FileCoverageSummary &FCS,
42 bool IsTotals = false) const;
43 std::string buildLinkToFile(StringRef SF,
44 const FileCoverageSummary &FCS) const;
47 /// A code coverage view which supports html-based rendering.
48 class SourceCoverageViewHTML : public SourceCoverageView {
49 void renderViewHeader(raw_ostream &OS) override;
51 void renderViewFooter(raw_ostream &OS) override;
53 void renderSourceName(raw_ostream &OS, bool WholeFile) override;
55 void renderLinePrefix(raw_ostream &OS, unsigned ViewDepth) override;
57 void renderLineSuffix(raw_ostream &OS, unsigned ViewDepth) override;
59 void renderViewDivider(raw_ostream &OS, unsigned ViewDepth) override;
61 void renderLine(raw_ostream &OS, LineRef L, const LineCoverageStats &LCS,
62 unsigned ExpansionCol, unsigned ViewDepth) override;
64 void renderExpansionSite(raw_ostream &OS, LineRef L,
65 const LineCoverageStats &LCS, unsigned ExpansionCol,
66 unsigned ViewDepth) override;
68 void renderExpansionView(raw_ostream &OS, ExpansionView &ESV,
69 unsigned ViewDepth) override;
71 void renderInstantiationView(raw_ostream &OS, InstantiationView &ISV,
72 unsigned ViewDepth) override;
74 void renderLineCoverageColumn(raw_ostream &OS,
75 const LineCoverageStats &Line) override;
77 void renderLineNumberColumn(raw_ostream &OS, unsigned LineNo) override;
79 void renderRegionMarkers(raw_ostream &OS, const LineCoverageStats &Line,
80 unsigned ViewDepth) override;
82 void renderTitle(raw_ostream &OS, StringRef Title) override;
84 void renderTableHeader(raw_ostream &OS, unsigned FirstUncoveredLineNo,
85 unsigned IndentLevel) override;
87 public:
88 SourceCoverageViewHTML(StringRef SourceName, const MemoryBuffer &File,
89 const CoverageViewOptions &Options,
90 coverage::CoverageData &&CoverageInfo)
91 : SourceCoverageView(SourceName, File, Options, std::move(CoverageInfo)) {
95 } // namespace llvm
97 #endif // LLVM_COV_SOURCECOVERAGEVIEWHTML_H