2018-01-04 20:33:29 +01:00
|
|
|
//===- CoverageReport.h - Code coverage report ----------------------------===//
|
2014-08-23 00:56:03 +02:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This class implements rendering of a code coverage report.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_COV_COVERAGEREPORT_H
|
|
|
|
#define LLVM_COV_COVERAGEREPORT_H
|
|
|
|
|
2017-09-28 12:07:30 +02:00
|
|
|
#include "CoverageFilters.h"
|
2015-02-14 03:01:24 +01:00
|
|
|
#include "CoverageSummaryInfo.h"
|
2015-01-14 12:23:27 +01:00
|
|
|
#include "CoverageViewOptions.h"
|
2014-08-23 00:56:03 +02:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
2018-05-01 17:54:18 +02:00
|
|
|
/// Displays the code coverage report.
|
2014-08-23 00:56:03 +02:00
|
|
|
class CoverageReport {
|
|
|
|
const CoverageViewOptions &Options;
|
2016-09-07 00:45:57 +02:00
|
|
|
const coverage::CoverageMapping &Coverage;
|
2014-08-23 00:56:03 +02:00
|
|
|
|
2016-09-09 03:32:49 +02:00
|
|
|
void render(const FileCoverageSummary &File, raw_ostream &OS) const;
|
2017-02-05 21:11:03 +01:00
|
|
|
void render(const FunctionCoverageSummary &Function, const DemangleCache &DC,
|
|
|
|
raw_ostream &OS) const;
|
2014-08-23 00:56:03 +02:00
|
|
|
|
|
|
|
public:
|
2015-02-14 03:01:24 +01:00
|
|
|
CoverageReport(const CoverageViewOptions &Options,
|
2016-09-07 00:45:57 +02:00
|
|
|
const coverage::CoverageMapping &Coverage)
|
|
|
|
: Options(Options), Coverage(Coverage) {}
|
2014-08-23 00:56:03 +02:00
|
|
|
|
2017-02-05 21:11:03 +01:00
|
|
|
void renderFunctionReports(ArrayRef<std::string> Files,
|
|
|
|
const DemangleCache &DC, raw_ostream &OS);
|
2014-08-23 00:56:03 +02:00
|
|
|
|
2016-09-09 03:32:49 +02:00
|
|
|
/// Prepare file reports for the files specified in \p Files.
|
2016-09-19 02:38:25 +02:00
|
|
|
static std::vector<FileCoverageSummary>
|
|
|
|
prepareFileReports(const coverage::CoverageMapping &Coverage,
|
2017-09-08 20:44:49 +02:00
|
|
|
FileCoverageSummary &Totals, ArrayRef<std::string> Files,
|
2017-09-28 12:07:30 +02:00
|
|
|
const CoverageViewOptions &Options,
|
|
|
|
const CoverageFilter &Filters = CoverageFiltersMatchAll());
|
2016-09-09 03:32:49 +02:00
|
|
|
|
2018-01-05 17:15:07 +01:00
|
|
|
static void
|
|
|
|
prepareSingleFileReport(const StringRef Filename,
|
|
|
|
const coverage::CoverageMapping *Coverage,
|
|
|
|
const CoverageViewOptions &Options,
|
|
|
|
const unsigned LCP,
|
|
|
|
FileCoverageSummary *FileReport,
|
|
|
|
const CoverageFilter *Filters);
|
|
|
|
|
2016-09-09 03:32:49 +02:00
|
|
|
/// Render file reports for every unique file in the coverage mapping.
|
2018-04-09 17:20:35 +02:00
|
|
|
void renderFileReports(raw_ostream &OS,
|
|
|
|
const CoverageFilters &IgnoreFilenameFilters) const;
|
2016-09-09 03:32:49 +02:00
|
|
|
|
2017-10-13 16:44:51 +02:00
|
|
|
/// Render file reports for the files specified in \p Files.
|
|
|
|
void renderFileReports(raw_ostream &OS, ArrayRef<std::string> Files) const;
|
|
|
|
|
2017-09-28 12:07:30 +02:00
|
|
|
/// Render file reports for the files specified in \p Files and the functions
|
|
|
|
/// in \p Filters.
|
|
|
|
void renderFileReports(raw_ostream &OS, ArrayRef<std::string> Files,
|
2017-10-03 13:05:28 +02:00
|
|
|
const CoverageFiltersMatchAll &Filters) const;
|
2014-08-23 00:56:03 +02:00
|
|
|
};
|
2016-09-07 00:45:57 +02:00
|
|
|
|
|
|
|
} // end namespace llvm
|
2014-08-23 00:56:03 +02:00
|
|
|
|
|
|
|
#endif // LLVM_COV_COVERAGEREPORT_H
|