]> granicus.if.org Git - llvm/commitdiff
[llvm-cov] Make a helper method static for re-use (NFC)
authorVedant Kumar <vsk@apple.com>
Mon, 19 Sep 2016 00:38:25 +0000 (00:38 +0000)
committerVedant Kumar <vsk@apple.com>
Mon, 19 Sep 2016 00:38:25 +0000 (00:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281876 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-cov/CoverageReport.cpp
tools/llvm-cov/CoverageReport.h
tools/llvm-cov/SourceCoverageViewHTML.cpp

index e70cce40a98767d88af2f4905f4d2d72b00e4630..0d34722eae5890d9ab79828d2521e8b4e973b56b 100644 (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)
index 7a06954adfe93bc1dc7b860a21e372726781bca3..37bb842f13d807a8c7ee8fd77fc5aa37e197845c 100644 (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;
index 1ef3219b10307f7b3e4066e7b5fe2b42eb1f0e0a..cb9760ad7c9fcf2e91a2bf7dc007b92126392952 100644 (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);