diff options
author | Alan Phipps <a-phipps@ti.com> | 2023-12-13 14:13:56 -0600 |
---|---|---|
committer | Alan Phipps <a-phipps@ti.com> | 2023-12-13 15:10:05 -0600 |
commit | 8ecbb0404d740d1ab173554e47cef39cd5e3ef8c (patch) | |
tree | 93cc0afc02965f5ccc27dc83c7389662ef772661 /llvm/tools/llvm-cov/SourceCoverageView.cpp | |
parent | 14d7e0bb0f75066da5d2eff718b6d59215a02077 (diff) | |
download | llvm-8ecbb0404d740d1ab173554e47cef39cd5e3ef8c.zip llvm-8ecbb0404d740d1ab173554e47cef39cd5e3ef8c.tar.gz llvm-8ecbb0404d740d1ab173554e47cef39cd5e3ef8c.tar.bz2 |
Reland "[Coverage][llvm-cov] Enable MC/DC Support in LLVM Source-based Code Coverage (2/3)"
Part 2 of 3. This includes the Visualization and Evaluation components.
Differential Revision: https://reviews.llvm.org/D138847
Diffstat (limited to 'llvm/tools/llvm-cov/SourceCoverageView.cpp')
-rw-r--r-- | llvm/tools/llvm-cov/SourceCoverageView.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/tools/llvm-cov/SourceCoverageView.cpp b/llvm/tools/llvm-cov/SourceCoverageView.cpp index 7480b7f..c910edd 100644 --- a/llvm/tools/llvm-cov/SourceCoverageView.cpp +++ b/llvm/tools/llvm-cov/SourceCoverageView.cpp @@ -178,6 +178,12 @@ void SourceCoverageView::addBranch(unsigned Line, BranchSubViews.emplace_back(Line, Regions, std::move(View)); } +void SourceCoverageView::addMCDCRecord( + unsigned Line, ArrayRef<MCDCRecord> Records, + std::unique_ptr<SourceCoverageView> View) { + MCDCSubViews.emplace_back(Line, Records, std::move(View)); +} + void SourceCoverageView::addInstantiation( StringRef FunctionName, unsigned Line, std::unique_ptr<SourceCoverageView> View) { @@ -203,12 +209,15 @@ void SourceCoverageView::print(raw_ostream &OS, bool WholeFile, llvm::stable_sort(ExpansionSubViews); llvm::stable_sort(InstantiationSubViews); llvm::stable_sort(BranchSubViews); + llvm::stable_sort(MCDCSubViews); auto NextESV = ExpansionSubViews.begin(); auto EndESV = ExpansionSubViews.end(); auto NextISV = InstantiationSubViews.begin(); auto EndISV = InstantiationSubViews.end(); auto NextBRV = BranchSubViews.begin(); auto EndBRV = BranchSubViews.end(); + auto NextMSV = MCDCSubViews.begin(); + auto EndMSV = MCDCSubViews.end(); // Get the coverage information for the file. auto StartSegment = CoverageInfo.begin(); @@ -276,6 +285,11 @@ void SourceCoverageView::print(raw_ostream &OS, bool WholeFile, renderBranchView(OS, *NextBRV, ViewDepth + 1); RenderedSubView = true; } + for (; NextMSV != EndMSV && NextMSV->Line == LI.line_number(); ++NextMSV) { + renderViewDivider(OS, ViewDepth + 1); + renderMCDCView(OS, *NextMSV, ViewDepth + 1); + RenderedSubView = true; + } if (RenderedSubView) renderViewDivider(OS, ViewDepth + 1); renderLineSuffix(OS, ViewDepth); |