@@ -102,8 +102,25 @@ void adjustColumnWidths(ArrayRef<StringRef> Files,
102
102
103
103
// / Prints a horizontal divider long enough to cover the given column
104
104
// / widths.
105
- void renderDivider (ArrayRef<size_t > ColumnWidths, raw_ostream &OS) {
106
- size_t Length = std::accumulate (ColumnWidths.begin (), ColumnWidths.end (), 0 );
105
+ void renderDivider (raw_ostream &OS, const CoverageViewOptions &Options, bool isFileReport) {
106
+ size_t Length;
107
+ if (isFileReport) {
108
+ Length = std::accumulate (std::begin (FileReportColumns), std::end (FileReportColumns), 0 );
109
+ if (!Options.ShowRegionSummary )
110
+ Length -= (FileReportColumns[1 ] + FileReportColumns[2 ] + FileReportColumns[3 ]);
111
+ if (!Options.ShowInstantiationSummary )
112
+ Length -= (FileReportColumns[7 ] + FileReportColumns[8 ] + FileReportColumns[9 ]);
113
+ if (!Options.ShowBranchSummary )
114
+ Length -= (FileReportColumns[13 ] + FileReportColumns[14 ] + FileReportColumns[15 ]);
115
+ if (!Options.ShowMCDCSummary )
116
+ Length -= (FileReportColumns[16 ] + FileReportColumns[17 ] + FileReportColumns[18 ]);
117
+ } else {
118
+ Length = std::accumulate (std::begin (FunctionReportColumns), std::end (FunctionReportColumns), 0 );
119
+ if (!Options.ShowBranchSummary )
120
+ Length -= (FunctionReportColumns[7 ] + FunctionReportColumns[8 ] + FunctionReportColumns[9 ]);
121
+ if (!Options.ShowMCDCSummary )
122
+ Length -= (FunctionReportColumns[10 ] + FunctionReportColumns[11 ] + FunctionReportColumns[12 ]);
123
+ }
107
124
for (size_t I = 0 ; I < Length; ++I)
108
125
OS << ' -' ;
109
126
}
@@ -405,7 +422,7 @@ void CoverageReport::renderFunctionReports(ArrayRef<std::string> Files,
405
422
<< column (" Miss" , FunctionReportColumns[11 ], Column::RightAlignment)
406
423
<< column (" Cover" , FunctionReportColumns[12 ], Column::RightAlignment);
407
424
OS << " \n " ;
408
- renderDivider (FunctionReportColumns, OS );
425
+ renderDivider (OS, Options, false );
409
426
OS << " \n " ;
410
427
FunctionCoverageSummary Totals (" TOTAL" );
411
428
for (const auto &F : Functions) {
@@ -418,7 +435,7 @@ void CoverageReport::renderFunctionReports(ArrayRef<std::string> Files,
418
435
render (Function, DC, OS);
419
436
}
420
437
if (Totals.ExecutionCount ) {
421
- renderDivider (FunctionReportColumns, OS );
438
+ renderDivider (OS, Options, false );
422
439
OS << " \n " ;
423
440
render (Totals, DC, OS);
424
441
}
@@ -544,7 +561,7 @@ void CoverageReport::renderFileReports(
544
561
Column::RightAlignment)
545
562
<< column (" Cover" , FileReportColumns[18 ], Column::RightAlignment);
546
563
OS << " \n " ;
547
- renderDivider (FileReportColumns, OS );
564
+ renderDivider (OS, Options, true );
548
565
OS << " \n " ;
549
566
550
567
std::vector<const FileCoverageSummary *> EmptyFiles;
@@ -563,7 +580,7 @@ void CoverageReport::renderFileReports(
563
580
render (*FCS, OS);
564
581
}
565
582
566
- renderDivider (FileReportColumns, OS );
583
+ renderDivider (OS, Options, true );
567
584
OS << " \n " ;
568
585
render (Totals, OS);
569
586
}
0 commit comments