Show code coverage only for functions that match the given regular expression.
+.. option:: -format=<FORMAT>
+
+ Use the specified output format. The supported formats are: "text".
+
.. option:: -line-coverage-gt=<N>
Show code coverage only for functions with line coverage greater than the
// NAN-NOT: 0{{[ \t]+}}nan%{{[ \t]+}}0{{[ \t]+}}nan%
// RUN: llvm-profdata merge %S/Inputs/prevent_false_instantiations.proftext -o %t.profdata
-// RUN: llvm-cov show %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %t.profdata -filename-equivalence %s | FileCheck %s -check-prefix=INSTANTIATION
+// RUN: llvm-cov show -format text %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %t.profdata -filename-equivalence %s | FileCheck %s -check-prefix=INSTANTIATION
// RUN: llvm-cov report %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %t.profdata | FileCheck %s -check-prefix=NAN
#define DO_SOMETHING() \
cl::desc("Show function instantiations"),
cl::cat(ViewCategory));
+ cl::opt<CoverageViewOptions::OutputFormat> ShowFormat(
+ "format", cl::desc("Output format for line-based coverage reports"),
+ cl::values(clEnumValN(CoverageViewOptions::OutputFormat::Text, "text",
+ "Text output"),
+ clEnumValEnd),
+ cl::init(CoverageViewOptions::OutputFormat::Text));
+
auto Err = commandLineParser(argc, argv);
if (Err)
return Err;
ViewOpts.ShowLineStatsOrRegionMarkers = ShowBestLineRegionsCounts;
ViewOpts.ShowExpandedRegions = ShowExpansions;
ViewOpts.ShowFunctionInstantiations = ShowInstantiations;
+ ViewOpts.ShowFormat = ShowFormat;
auto Coverage = load();
if (!Coverage)
/// \brief The options for displaying the code coverage information.
struct CoverageViewOptions {
+ enum class OutputFormat {
+ Text
+ };
+
bool Debug;
bool Colors;
bool ShowLineNumbers;
bool ShowExpandedRegions;
bool ShowFunctionInstantiations;
bool ShowFullFilenames;
+ OutputFormat ShowFormat;
/// \brief Change the output's stream color if the colors are enabled.
ColoredRawOstream colored_ostream(raw_ostream &OS,
SourceCoverageView::create(StringRef SourceName, const MemoryBuffer &File,
const CoverageViewOptions &Options,
coverage::CoverageData &&CoverageInfo) {
- return llvm::make_unique<SourceCoverageViewText>(SourceName, File, Options,
- std::move(CoverageInfo));
+ switch (Options.ShowFormat) {
+ case CoverageViewOptions::OutputFormat::Text:
+ return llvm::make_unique<SourceCoverageViewText>(SourceName, File, Options,
+ std::move(CoverageInfo));
+ }
}
void SourceCoverageView::print(raw_ostream &OS, bool WholeFile,