[llvm-cov] Make a helper method static for re-use (NFC)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281876 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Vedant Kumar 2016-09-19 00:38:25 +00:00
parent e17f26f066
commit a830753405
3 changed files with 9 additions and 8 deletions

View File

@ -259,8 +259,9 @@ void CoverageReport::renderFunctionReports(ArrayRef<StringRef> Files,
}
std::vector<FileCoverageSummary>
CoverageReport::prepareFileReports(FileCoverageSummary &Totals,
ArrayRef<StringRef> Files) const {
CoverageReport::prepareFileReports(const coverage::CoverageMapping &Coverage,
FileCoverageSummary &Totals,
ArrayRef<StringRef> Files) {
std::vector<FileCoverageSummary> FileReports;
unsigned LCP = 0;
if (Files.size() > 1)
@ -304,7 +305,7 @@ void CoverageReport::renderFileReports(raw_ostream &OS) const {
void CoverageReport::renderFileReports(raw_ostream &OS,
ArrayRef<StringRef> Files) const {
FileCoverageSummary Totals("TOTAL");
auto FileReports = prepareFileReports(Totals, Files);
auto FileReports = prepareFileReports(Coverage, Totals, Files);
std::vector<StringRef> Filenames;
for (const FileCoverageSummary &FCS : FileReports)

View File

@ -35,9 +35,9 @@ public:
void renderFunctionReports(ArrayRef<StringRef> Files, raw_ostream &OS);
/// Prepare file reports for the files specified in \p Files.
std::vector<FileCoverageSummary>
prepareFileReports(FileCoverageSummary &Totals,
ArrayRef<StringRef> Files) const;
static std::vector<FileCoverageSummary>
prepareFileReports(const coverage::CoverageMapping &Coverage,
FileCoverageSummary &Totals, ArrayRef<StringRef> Files);
/// Render file reports for every unique file in the coverage mapping.
void renderFileReports(raw_ostream &OS) const;

View File

@ -375,11 +375,11 @@ Error CoveragePrinterHTML::createIndexFile(
OSRef << tag(CreatedTimeTag, escape(Opts.CreatedTimeStr, Opts));
// Emit a table containing links to reports for each file in the covmapping.
CoverageReport Report(Opts, Coverage);
OSRef << BeginCenteredDiv << BeginTable;
emitColumnLabelsForIndex(OSRef);
FileCoverageSummary Totals("TOTALS");
auto FileReports = Report.prepareFileReports(Totals, SourceFiles);
auto FileReports =
CoverageReport::prepareFileReports(Coverage, Totals, SourceFiles);
for (unsigned I = 0, E = FileReports.size(); I < E; ++I)
emitFileSummary(OSRef, SourceFiles[I], FileReports[I]);
emitFileSummary(OSRef, "Totals", Totals, /*IsTotals=*/true);