2016-06-25 10:58:30 +08:00
|
|
|
//===- SourceCoverageViewText.h - A text-based code coverage view ---------===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08: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-06-25 10:58:30 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2016-06-25 13:48:54 +08:00
|
|
|
///
|
|
|
|
/// \file This file defines the interface to the text-based coverage renderer.
|
|
|
|
///
|
2016-06-25 10:58:30 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_COV_SOURCECOVERAGEVIEWTEXT_H
|
|
|
|
#define LLVM_COV_SOURCECOVERAGEVIEWTEXT_H
|
|
|
|
|
|
|
|
#include "SourceCoverageView.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
2017-10-19 07:58:27 +08:00
|
|
|
using namespace coverage;
|
|
|
|
|
2018-05-01 23:54:18 +08:00
|
|
|
/// A coverage printer for text output.
|
2016-06-29 00:12:24 +08:00
|
|
|
class CoveragePrinterText : public CoveragePrinter {
|
2016-06-28 10:09:39 +08:00
|
|
|
public:
|
2016-06-29 00:12:24 +08:00
|
|
|
Expected<OwnedStream> createViewFile(StringRef Path,
|
|
|
|
bool InToplevel) override;
|
|
|
|
|
|
|
|
void closeViewFile(OwnedStream OS) override;
|
2016-06-28 10:09:39 +08:00
|
|
|
|
2016-09-24 02:57:32 +08:00
|
|
|
Error createIndexFile(ArrayRef<std::string> SourceFiles,
|
2017-10-19 07:58:27 +08:00
|
|
|
const CoverageMapping &Coverage,
|
2017-10-03 19:05:28 +08:00
|
|
|
const CoverageFiltersMatchAll &Filters) override;
|
2016-06-28 10:09:39 +08:00
|
|
|
|
2016-06-29 00:12:24 +08:00
|
|
|
CoveragePrinterText(const CoverageViewOptions &Opts)
|
|
|
|
: CoveragePrinter(Opts) {}
|
|
|
|
};
|
|
|
|
|
2018-05-01 23:54:18 +08:00
|
|
|
/// A code coverage view which supports text-based rendering.
|
2016-06-29 00:12:24 +08:00
|
|
|
class SourceCoverageViewText : public SourceCoverageView {
|
2016-06-29 08:38:21 +08:00
|
|
|
void renderViewHeader(raw_ostream &OS) override;
|
|
|
|
|
|
|
|
void renderViewFooter(raw_ostream &OS) override;
|
|
|
|
|
2016-09-11 03:37:26 +08:00
|
|
|
void renderSourceName(raw_ostream &OS, bool WholeFile) override;
|
2016-06-25 10:58:30 +08:00
|
|
|
|
|
|
|
void renderLinePrefix(raw_ostream &OS, unsigned ViewDepth) override;
|
|
|
|
|
2016-06-29 08:38:21 +08:00
|
|
|
void renderLineSuffix(raw_ostream &OS, unsigned ViewDepth) override;
|
|
|
|
|
2016-06-25 10:58:30 +08:00
|
|
|
void renderViewDivider(raw_ostream &OS, unsigned ViewDepth) override;
|
|
|
|
|
2017-10-19 02:52:28 +08:00
|
|
|
void renderLine(raw_ostream &OS, LineRef L, const LineCoverageStats &LCS,
|
|
|
|
unsigned ExpansionCol, unsigned ViewDepth) override;
|
2016-06-25 10:58:30 +08:00
|
|
|
|
2016-06-29 08:38:21 +08:00
|
|
|
void renderExpansionSite(raw_ostream &OS, LineRef L,
|
2017-10-19 02:52:28 +08:00
|
|
|
const LineCoverageStats &LCS, unsigned ExpansionCol,
|
2016-06-26 10:45:13 +08:00
|
|
|
unsigned ViewDepth) override;
|
|
|
|
|
|
|
|
void renderExpansionView(raw_ostream &OS, ExpansionView &ESV,
|
|
|
|
unsigned ViewDepth) override;
|
2020-12-29 01:20:48 +08:00
|
|
|
|
|
|
|
void renderBranchView(raw_ostream &OS, BranchView &BRV,
|
|
|
|
unsigned ViewDepth) override;
|
2016-06-25 10:58:30 +08: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-19 02:52:28 +08:00
|
|
|
void renderRegionMarkers(raw_ostream &OS, const LineCoverageStats &Line,
|
2016-06-25 10:58:30 +08:00
|
|
|
unsigned ViewDepth) override;
|
|
|
|
|
2016-09-15 12:45:59 +08:00
|
|
|
void renderTitle(raw_ostream &OS, StringRef Title) override;
|
2016-08-24 22:27:23 +08:00
|
|
|
|
2016-09-11 03:37:26 +08:00
|
|
|
void renderTableHeader(raw_ostream &OS, unsigned FirstUncoveredLineNo,
|
|
|
|
unsigned IndentLevel) override;
|
2016-08-24 22:27:23 +08:00
|
|
|
|
2016-06-25 10:58:30 +08:00
|
|
|
public:
|
|
|
|
SourceCoverageViewText(StringRef SourceName, const MemoryBuffer &File,
|
|
|
|
const CoverageViewOptions &Options,
|
2017-10-19 07:58:27 +08:00
|
|
|
CoverageData &&CoverageInfo)
|
2016-09-08 08:56:48 +08:00
|
|
|
: SourceCoverageView(SourceName, File, Options, std::move(CoverageInfo)) {
|
|
|
|
}
|
2016-06-25 10:58:30 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace llvm
|
|
|
|
|
|
|
|
#endif // LLVM_COV_SOURCECOVERAGEVIEWTEXT_H
|