}
bool SourceCoverageView::shouldRenderRegionMarkers(
- CoverageSegmentArray Segments) const {
+ const LineCoverageStats &LCS) const {
if (!getOptions().ShowRegionMarkers)
return false;
- // Render the region markers if there's more than one count to show.
- unsigned RegionCount = 0;
- for (const auto *S : Segments)
- if (S->IsRegionEntry)
- if (++RegionCount > 1)
- return true;
+ CoverageSegmentArray Segments = LCS.getLineSegments();
+ if (Segments.empty())
+ return false;
+ for (unsigned I = 0, E = Segments.size() - 1; I < E; ++I) {
+ const auto *CurSeg = Segments[I];
+ if (!CurSeg->IsRegionEntry || CurSeg->Count == LCS.getExecutionCount())
+ continue;
+ return true;
+ }
return false;
}
renderLine(OS, {*LI, LI.line_number()}, *LCI, ExpansionColumn, ViewDepth);
// Show the region markers.
- if (shouldRenderRegionMarkers(LCI->getLineSegments()))
+ if (shouldRenderRegionMarkers(*LCI))
renderRegionMarkers(OS, *LCI, ViewDepth);
// Show the expansions and instantiations for this line.
static std::string formatCount(uint64_t N);
/// \brief Check if region marker output is expected for a line.
- bool shouldRenderRegionMarkers(CoverageSegmentArray Segments) const;
+ bool shouldRenderRegionMarkers(const LineCoverageStats &LCS) const;
/// \brief Check if there are any sub-views attached to this view.
bool hasSubViews() const;
// 4. Snippets[1:N+1] correspond to \p Segments[0:N]: use these to generate
// sub-line region count tooltips if needed.
- if (shouldRenderRegionMarkers(Segments)) {
+ if (shouldRenderRegionMarkers(LCS)) {
// Just consider the segments which start *and* end on this line.
for (unsigned I = 0, E = Segments.size() - 1; I < E; ++I) {
const auto *CurSeg = Segments[I];