2016-07-06 23:44:05 +02:00
|
|
|
//===- SourceCoverageViewHTML.h - A html code coverage view ---------------===//
|
|
|
|
//
|
2019-01-19 09:50:56 +01:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2016-07-06 23:44:05 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
///
|
|
|
|
/// \file This file defines the interface to the html coverage renderer.
|
|
|
|
///
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_COV_SOURCECOVERAGEVIEWHTML_H
|
|
|
|
#define LLVM_COV_SOURCECOVERAGEVIEWHTML_H
|
|
|
|
|
|
|
|
#include "SourceCoverageView.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
2017-10-19 01:58:27 +02:00
|
|
|
using namespace coverage;
|
|
|
|
|
2016-09-09 03:32:55 +02:00
|
|
|
struct FileCoverageSummary;
|
|
|
|
|
2018-05-01 17:54:18 +02:00
|
|
|
/// A coverage printer for html output.
|
2016-07-06 23:44:05 +02:00
|
|
|
class CoveragePrinterHTML : public CoveragePrinter {
|
|
|
|
public:
|
|
|
|
Expected<OwnedStream> createViewFile(StringRef Path,
|
|
|
|
bool InToplevel) override;
|
|
|
|
|
|
|
|
void closeViewFile(OwnedStream OS) override;
|
|
|
|
|
2016-09-23 20:57:32 +02:00
|
|
|
Error createIndexFile(ArrayRef<std::string> SourceFiles,
|
2017-09-28 12:07:30 +02:00
|
|
|
const coverage::CoverageMapping &Coverage,
|
2017-10-03 13:05:28 +02:00
|
|
|
const CoverageFiltersMatchAll &Filters) override;
|
2016-07-06 23:44:05 +02:00
|
|
|
|
|
|
|
CoveragePrinterHTML(const CoverageViewOptions &Opts)
|
|
|
|
: CoveragePrinter(Opts) {}
|
2016-09-09 03:32:55 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
void emitFileSummary(raw_ostream &OS, StringRef SF,
|
|
|
|
const FileCoverageSummary &FCS,
|
|
|
|
bool IsTotals = false) const;
|
2017-08-09 22:43:31 +02:00
|
|
|
std::string buildLinkToFile(StringRef SF,
|
|
|
|
const FileCoverageSummary &FCS) const;
|
2016-07-06 23:44:05 +02:00
|
|
|
};
|
|
|
|
|
2018-05-01 17:54:18 +02:00
|
|
|
/// A code coverage view which supports html-based rendering.
|
2016-07-06 23:44:05 +02:00
|
|
|
class SourceCoverageViewHTML : public SourceCoverageView {
|
|
|
|
void renderViewHeader(raw_ostream &OS) override;
|
|
|
|
|
|
|
|
void renderViewFooter(raw_ostream &OS) override;
|
|
|
|
|
2016-09-10 21:37:26 +02:00
|
|
|
void renderSourceName(raw_ostream &OS, bool WholeFile) override;
|
2016-07-06 23:44:05 +02:00
|
|
|
|
|
|
|
void renderLinePrefix(raw_ostream &OS, unsigned ViewDepth) override;
|
|
|
|
|
|
|
|
void renderLineSuffix(raw_ostream &OS, unsigned ViewDepth) override;
|
|
|
|
|
|
|
|
void renderViewDivider(raw_ostream &OS, unsigned ViewDepth) override;
|
|
|
|
|
2017-10-18 20:52:28 +02:00
|
|
|
void renderLine(raw_ostream &OS, LineRef L, const LineCoverageStats &LCS,
|
|
|
|
unsigned ExpansionCol, unsigned ViewDepth) override;
|
2016-07-06 23:44:05 +02:00
|
|
|
|
|
|
|
void renderExpansionSite(raw_ostream &OS, LineRef L,
|
2017-10-18 20:52:28 +02:00
|
|
|
const LineCoverageStats &LCS, unsigned ExpansionCol,
|
2016-07-06 23:44:05 +02:00
|
|
|
unsigned ViewDepth) override;
|
|
|
|
|
|
|
|
void renderExpansionView(raw_ostream &OS, ExpansionView &ESV,
|
|
|
|
unsigned ViewDepth) override;
|
2020-12-28 18:20:48 +01:00
|
|
|
|
|
|
|
void renderBranchView(raw_ostream &OS, BranchView &BRV,
|
|
|
|
unsigned ViewDepth) override;
|
2016-07-06 23:44:05 +02:00
|
|
|
|
|
|
|
void renderInstantiationView(raw_ostream &OS, InstantiationView &ISV,
|
|
|
|
unsigned ViewDepth) override;
|
|
|
|
|
|
|
|
void renderLineCoverageColumn(raw_ostream &OS,
|
|
|
|
const LineCoverageStats &Line) override;
|
|
|
|
|
|
|
|
void renderLineNumberColumn(raw_ostream &OS, unsigned LineNo) override;
|
|
|
|
|
2017-10-18 20:52:28 +02:00
|
|
|
void renderRegionMarkers(raw_ostream &OS, const LineCoverageStats &Line,
|
2016-07-06 23:44:05 +02:00
|
|
|
unsigned ViewDepth) override;
|
|
|
|
|
2016-09-15 06:45:59 +02:00
|
|
|
void renderTitle(raw_ostream &OS, StringRef Title) override;
|
2016-08-24 16:27:23 +02:00
|
|
|
|
2016-09-10 21:37:26 +02:00
|
|
|
void renderTableHeader(raw_ostream &OS, unsigned FirstUncoveredLineNo,
|
|
|
|
unsigned IndentLevel) override;
|
2016-08-24 16:27:23 +02:00
|
|
|
|
2016-07-06 23:44:05 +02:00
|
|
|
public:
|
|
|
|
SourceCoverageViewHTML(StringRef SourceName, const MemoryBuffer &File,
|
|
|
|
const CoverageViewOptions &Options,
|
2016-09-08 02:56:48 +02:00
|
|
|
coverage::CoverageData &&CoverageInfo)
|
|
|
|
: SourceCoverageView(SourceName, File, Options, std::move(CoverageInfo)) {
|
|
|
|
}
|
2016-07-06 23:44:05 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace llvm
|
|
|
|
|
|
|
|
#endif // LLVM_COV_SOURCECOVERAGEVIEWHTML_H
|