[llvm-cov] Add an API to prepare file reports (NFC)
It would be nice to prepare file reports (using the CoverageReport API)
without actually rendering them to the console. I plan on using this to
flesh out the 'index' files in the coverage views.
llvm-svn: 281009
diff --git a/llvm/tools/llvm-cov/CoverageReport.h b/llvm/tools/llvm-cov/CoverageReport.h
index 8d6a20e..7a06954 100644
--- a/llvm/tools/llvm-cov/CoverageReport.h
+++ b/llvm/tools/llvm-cov/CoverageReport.h
@@ -24,8 +24,8 @@
const CoverageViewOptions &Options;
const coverage::CoverageMapping &Coverage;
- void render(const FileCoverageSummary &File, raw_ostream &OS);
- void render(const FunctionCoverageSummary &Function, raw_ostream &OS);
+ void render(const FileCoverageSummary &File, raw_ostream &OS) const;
+ void render(const FunctionCoverageSummary &Function, raw_ostream &OS) const;
public:
CoverageReport(const CoverageViewOptions &Options,
@@ -34,7 +34,16 @@
void renderFunctionReports(ArrayRef<StringRef> Files, raw_ostream &OS);
- void renderFileReports(raw_ostream &OS);
+ /// Prepare file reports for the files specified in \p Files.
+ std::vector<FileCoverageSummary>
+ prepareFileReports(FileCoverageSummary &Totals,
+ ArrayRef<StringRef> Files) const;
+
+ /// Render file reports for every unique file in the coverage mapping.
+ void renderFileReports(raw_ostream &OS) const;
+
+ /// Render file reports for the files specified in \p Files.
+ void renderFileReports(raw_ostream &OS, ArrayRef<StringRef> Files) const;
};
} // end namespace llvm