aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-cov/CodeCoverage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-cov/CodeCoverage.cpp')
-rw-r--r--llvm/tools/llvm-cov/CodeCoverage.cpp26
1 files changed, 9 insertions, 17 deletions
diff --git a/llvm/tools/llvm-cov/CodeCoverage.cpp b/llvm/tools/llvm-cov/CodeCoverage.cpp
index 6405bb1..049e89d 100644
--- a/llvm/tools/llvm-cov/CodeCoverage.cpp
+++ b/llvm/tools/llvm-cov/CodeCoverage.cpp
@@ -343,17 +343,14 @@ void CodeCoverageTool::attachBranchSubViews(SourceCoverageView &View,
// Group branches that have the same line number into the same subview.
while (NextBranch != EndBranch) {
- std::vector<CountedRegion> ViewBranches;
+ SmallVector<CountedRegion, 0> ViewBranches;
unsigned CurrentLine = NextBranch->LineStart;
-
while (NextBranch != EndBranch && CurrentLine == NextBranch->LineStart)
ViewBranches.push_back(*NextBranch++);
- if (!ViewBranches.empty()) {
- auto SubView = SourceCoverageView::create(SourceName, File, ViewOpts,
- std::move(CoverageInfo));
- View.addBranch(CurrentLine, ViewBranches, std::move(SubView));
- }
+ View.addBranch(CurrentLine, std::move(ViewBranches),
+ SourceCoverageView::create(SourceName, File, ViewOpts,
+ std::move(CoverageInfo)));
}
}
@@ -371,20 +368,15 @@ void CodeCoverageTool::attachMCDCSubViews(SourceCoverageView &View,
// Group and process MCDC records that have the same line number into the
// same subview.
while (NextRecord != EndRecord) {
- std::vector<MCDCRecord> ViewMCDCRecords;
+ SmallVector<MCDCRecord, 0> ViewMCDCRecords;
unsigned CurrentLine = NextRecord->getDecisionRegion().LineEnd;
-
while (NextRecord != EndRecord &&
- CurrentLine == NextRecord->getDecisionRegion().LineEnd) {
+ CurrentLine == NextRecord->getDecisionRegion().LineEnd)
ViewMCDCRecords.push_back(*NextRecord++);
- }
-
- if (ViewMCDCRecords.empty())
- continue;
- auto SubView = SourceCoverageView::create(SourceName, File, ViewOpts,
- std::move(CoverageInfo));
- View.addMCDCRecord(CurrentLine, ViewMCDCRecords, std::move(SubView));
+ View.addMCDCRecord(CurrentLine, std::move(ViewMCDCRecords),
+ SourceCoverageView::create(SourceName, File, ViewOpts,
+ std::move(CoverageInfo)));
}
}