Index: test/tools/llvm-cov/showProjectSummary.cpp =================================================================== --- test/tools/llvm-cov/showProjectSummary.cpp +++ test/tools/llvm-cov/showProjectSummary.cpp @@ -12,24 +12,27 @@ } // Test console output. -// RUN: llvm-cov show %S/Inputs/showProjectSummary.covmapping -instr-profile %t.profdata -filename-equivalence %s | FileCheck -check-prefixes=TEXT,TEXT-FILE,TEXT-HEADER %s -// RUN: llvm-cov show %S/Inputs/showProjectSummary.covmapping -instr-profile %t.profdata -project-title "Test Suite" -filename-equivalence %s | FileCheck -check-prefixes=TEXT-TITLE,TEXT,TEXT-FILE,TEXT-HEADER %s -// RUN: llvm-cov show %S/Inputs/showProjectSummary.covmapping -instr-profile %t.profdata -project-title "Test Suite" -name=main -filename-equivalence %s | FileCheck -check-prefixes=TEXT-FUNCTION,TEXT-HEADER %s +// RUN: llvm-cov show %S/Inputs/showProjectSummary.covmapping -instr-profile %t.profdata -filename-equivalence %s | FileCheck -check-prefixes=TEXT,TEXT-FILE,TEXT-HEADER,TEXT-FOOTER %s +// RUN: llvm-cov show %S/Inputs/showProjectSummary.covmapping -instr-profile %t.profdata -project-title "Test Suite" -filename-equivalence %s | FileCheck -check-prefixes=TEXT-TITLE,TEXT,TEXT-FILE,TEXT-HEADER,TEXT-FOOTER %s +// RUN: llvm-cov show %S/Inputs/showProjectSummary.covmapping -instr-profile %t.profdata -project-title "Test Suite" -name=main -filename-equivalence %s | FileCheck -check-prefixes=TEXT-FUNCTION,TEXT-HEADER,TEXT-FOOTER %s +// RUN: llvm-cov show %S/Inputs/showProjectSummary.covmapping -instr-profile=%t.profdata -o %t.dir -filename-equivalence %s +// RUN: FileCheck -check-prefixes=TEXT-FOOTER -input-file=%t.dir/index.txt %s // TEXT-TITLE: Test Suite // TEXT: Coverage Report // TEXT: Created: // TEXT-FILE: showProjectSummary.cpp: // TEXT-FILE: showProjectSummary.covmapping: // TEXT-FUNCTION: main: +// TEXT-FOOTER: Generated by llvm-cov // Test html output. // RUN: llvm-cov show %S/Inputs/showProjectSummary.covmapping -format=html -o %t.dir -instr-profile %t.profdata -filename-equivalence %s -// RUN: FileCheck -check-prefixes=HTML,HTML-FILE,HTML-HEADER -input-file %t.dir/coverage/tmp/showProjectSummary.cpp.html %s +// RUN: FileCheck -check-prefixes=HTML,HTML-FILE,HTML-HEADER,HTML-FOOTER -input-file %t.dir/coverage/tmp/showProjectSummary.cpp.html %s // RUN: llvm-cov show %S/Inputs/showProjectSummary.covmapping -format=html -o %t.dir -instr-profile %t.profdata -project-title "Test Suite" -filename-equivalence %s -// RUN: FileCheck -check-prefixes=HTML-TITLE,HTML,HTML-FILE,HTML-HEADER -input-file %t.dir/coverage/tmp/showProjectSummary.cpp.html %s -// RUN: FileCheck -check-prefixes=HTML-TITLE,HTML -input-file %t.dir/index.html %s +// RUN: FileCheck -check-prefixes=HTML-TITLE,HTML,HTML-FILE,HTML-HEADER,HTML-FOOTER -input-file %t.dir/coverage/tmp/showProjectSummary.cpp.html %s +// RUN: FileCheck -check-prefixes=HTML-TITLE,HTML,HTML-FOOTER -input-file %t.dir/index.html %s // RUN: llvm-cov show %S/Inputs/showProjectSummary.covmapping -format=html -o %t.dir -instr-profile %t.profdata -project-title "Test Suite" -filename-equivalence -name=main %s -// RUN: FileCheck -check-prefixes=HTML-FUNCTION,HTML-HEADER -input-file %t.dir/functions.html %s +// RUN: FileCheck -check-prefixes=HTML-FUNCTION,HTML-HEADER,HTML-FOOTER -input-file %t.dir/functions.html %s // HTML-TITLE:

Test Suite

// HTML:

Coverage Report

// HTML:

Created:{{.*}}

@@ -38,3 +41,4 @@ // HTML-HEADER:
Line No.
// HTML-HEADER:
Count
// HTML-HEADER:
Source (jump to first uncovered line)
+// HTML-FOOTER:
Generated by llvm-cov{{.*}}
Index: tools/llvm-cov/CoverageViewOptions.h =================================================================== --- tools/llvm-cov/CoverageViewOptions.h +++ tools/llvm-cov/CoverageViewOptions.h @@ -56,6 +56,13 @@ /// \brief Check if the created time of the profile data file is available. bool hasCreatedTime() const { return !CreatedTimeStr.empty(); } + + /// \brief Get the LLVM version string. + std::string getLLVMVersionString() const { + std::string VersionString = "Generated by llvm-cov -- llvm version "; + VersionString += LLVM_VERSION_STRING; + return VersionString; + } }; } Index: tools/llvm-cov/SourceCoverageViewHTML.cpp =================================================================== --- tools/llvm-cov/SourceCoverageViewHTML.cpp +++ tools/llvm-cov/SourceCoverageViewHTML.cpp @@ -381,7 +381,8 @@ for (unsigned I = 0, E = FileReports.size(); I < E; ++I) emitFileSummary(OSRef, SourceFiles[I], FileReports[I]); emitFileSummary(OSRef, "Totals", Totals, /*IsTotals=*/true); - OSRef << EndTable << EndCenteredDiv; + OSRef << EndTable << EndCenteredDiv + << tag("h5", escape(Opts.getLLVMVersionString(), Opts)); emitEpilog(OSRef); return Error::success(); @@ -392,7 +393,8 @@ } void SourceCoverageViewHTML::renderViewFooter(raw_ostream &OS) { - OS << EndTable << EndCenteredDiv; + OS << EndTable << EndCenteredDiv + << tag("h5", escape(getOptions().getLLVMVersionString(), getOptions())); } void SourceCoverageViewHTML::renderSourceName(raw_ostream &OS, bool WholeFile) { Index: tools/llvm-cov/SourceCoverageViewText.cpp =================================================================== --- tools/llvm-cov/SourceCoverageViewText.cpp +++ tools/llvm-cov/SourceCoverageViewText.cpp @@ -40,6 +40,9 @@ CoverageReport Report(Opts, Coverage); Report.renderFileReports(OSRef); + Opts.colored_ostream(OSRef, raw_ostream::CYAN) << "\n" + << Opts.getLLVMVersionString(); + return Error::success(); } @@ -64,7 +67,10 @@ void SourceCoverageViewText::renderViewHeader(raw_ostream &) {} -void SourceCoverageViewText::renderViewFooter(raw_ostream &) {} +void SourceCoverageViewText::renderViewFooter(raw_ostream &OS) { + getOptions().colored_ostream(OS, raw_ostream::CYAN) + << "\n" << getOptions().getLLVMVersionString(); +} void SourceCoverageViewText::renderSourceName(raw_ostream &OS, bool WholeFile) { std::string ViewInfo = WholeFile ? getVerboseSourceName() : getSourceName();