From a59334da6baf812ac6e8b2e140a2ac2599654479 Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Fri, 9 Sep 2016 01:32:55 +0000 Subject: [llvm-cov] Emit a summary in the report directory's index llvm-cov writes out an index file in '-output-dir' mode, albeit not a very informative one. Try to fix that by using the CoverageReport API to include some basic summary information in the index file. llvm-svn: 281011 --- llvm/tools/llvm-cov/SourceCoverageViewText.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'llvm/tools/llvm-cov/SourceCoverageViewText.cpp') diff --git a/llvm/tools/llvm-cov/SourceCoverageViewText.cpp b/llvm/tools/llvm-cov/SourceCoverageViewText.cpp index 3d2c067d0a4..b0676cad7b9 100644 --- a/llvm/tools/llvm-cov/SourceCoverageViewText.cpp +++ b/llvm/tools/llvm-cov/SourceCoverageViewText.cpp @@ -11,6 +11,7 @@ /// //===----------------------------------------------------------------------===// +#include "CoverageReport.h" #include "SourceCoverageViewText.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallString.h" @@ -27,15 +28,17 @@ void CoveragePrinterText::closeViewFile(OwnedStream OS) { OS->operator<<('\n'); } -Error CoveragePrinterText::createIndexFile(ArrayRef SourceFiles) { +Error CoveragePrinterText::createIndexFile( + ArrayRef SourceFiles, + const coverage::CoverageMapping &Coverage) { auto OSOrErr = createOutputStream("index", "txt", /*InToplevel=*/true); if (Error E = OSOrErr.takeError()) return E; auto OS = std::move(OSOrErr.get()); raw_ostream &OSRef = *OS.get(); - for (StringRef SF : SourceFiles) - OSRef << getOutputPath(SF, "txt", /*InToplevel=*/false) << '\n'; + CoverageReport Report(Opts, Coverage); + Report.renderFileReports(OSRef); return Error::success(); } -- cgit v1.2.3