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