// RUN: llvm-profdata merge %S/Inputs/branch-showBranchPercentage.proftext -o %t.profdata
// RUN: llvm-cov export --format=lcov %S/Inputs/branch-showBranchPercentage.o32l -instr-profile %t.profdata | FileCheck %s
+// RUN: llvm-cov export --format=lcov --skip-branches %S/Inputs/branch-showBranchPercentage.o32l -instr-profile %t.profdata | FileCheck %s --check-prefix=NOBRANCH
// CHECK-DAG: BRDA:14,0,0,1
// CHECK-DAG: BRDA:14,0,1,5
// Check recursive macro-expansions.
// RUN: llvm-profdata merge %S/Inputs/branch-macros.proftext -o %t.profdata
// RUN: llvm-cov export --format=lcov %S/Inputs/branch-macros.o32l -instr-profile %t.profdata | FileCheck %s -check-prefix=MACROS
+// RUN: llvm-cov export --format=lcov --skip-branches %S/Inputs/branch-macros.o32l -instr-profile %t.profdata | FileCheck %s -check-prefix=NOBRANCH
// MACROS-COUNT-4: BRDA:17
// MACROS-NOT: BRDA:17
// MACROS-NOT: BRDA
// MACROS: BRF:40
// MACROS: BRH:24
+
+// NOBRANCH-NOT: BRDA
+// NOBRANCH-NOT: BRF
+// NOBRANCH-NOT: BRH
+
cl::desc("Don't export per-function data"),
cl::cat(ExportCategory));
+ cl::opt<bool> SkipBranches("skip-branches", cl::Optional,
+ cl::desc("Don't export branch data (LCOV)"),
+ cl::cat(ExportCategory));
+
auto Err = commandLineParser(argc, argv);
if (Err)
return Err;
ViewOpts.SkipExpansions = SkipExpansions;
ViewOpts.SkipFunctions = SkipFunctions;
+ ViewOpts.SkipBranches = SkipBranches;
if (ViewOpts.Format != CoverageViewOptions::OutputFormat::Text &&
ViewOpts.Format != CoverageViewOptions::OutputFormat::Lcov) {
void renderFile(raw_ostream &OS, const coverage::CoverageMapping &Coverage,
const std::string &Filename,
const FileCoverageSummary &FileReport, bool ExportSummaryOnly,
- bool SkipFunctions) {
+ bool SkipFunctions, bool SkipBranches) {
OS << "SF:" << Filename << '\n';
if (!ExportSummaryOnly && !SkipFunctions) {
// Calculate and render detailed coverage information for given file.
auto FileCoverage = Coverage.getCoverageForFile(Filename);
renderLineExecutionCounts(OS, FileCoverage);
- renderBranchExecutionCounts(OS, Coverage, FileCoverage);
+ if (!SkipBranches)
+ renderBranchExecutionCounts(OS, Coverage, FileCoverage);
}
- renderBranchSummary(OS, FileReport);
+ if (!SkipBranches)
+ renderBranchSummary(OS, FileReport);
renderLineSummary(OS, FileReport);
OS << "end_of_record\n";
void renderFiles(raw_ostream &OS, const coverage::CoverageMapping &Coverage,
ArrayRef<std::string> SourceFiles,
ArrayRef<FileCoverageSummary> FileReports,
- bool ExportSummaryOnly, bool SkipFunctions) {
+ bool ExportSummaryOnly, bool SkipFunctions,
+ bool SkipBranches) {
for (unsigned I = 0, E = SourceFiles.size(); I < E; ++I)
renderFile(OS, Coverage, SourceFiles[I], FileReports[I], ExportSummaryOnly,
- SkipFunctions);
+ SkipFunctions, SkipBranches);
}
} // end anonymous namespace
auto FileReports = CoverageReport::prepareFileReports(Coverage, Totals,
SourceFiles, Options);
renderFiles(OS, Coverage, SourceFiles, FileReports, Options.ExportSummaryOnly,
- Options.SkipFunctions);
+ Options.SkipFunctions, Options.SkipBranches);
}