diff options
author | Vedant Kumar <vsk@apple.com> | 2017-09-19 02:00:12 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2017-09-19 02:00:12 +0000 |
commit | b7fdaf2cd403e99f3079efafc1793e3e7868a245 (patch) | |
tree | 3c7d9aba6a9b0731755dd7da5e049d60cef46e14 /llvm/tools/llvm-cov/SourceCoverageView.cpp | |
parent | ef8e05ff07e3ff6b7d9aedb615b12a2ed61b9d01 (diff) | |
download | llvm-b7fdaf2cd403e99f3079efafc1793e3e7868a245.zip llvm-b7fdaf2cd403e99f3079efafc1793e3e7868a245.tar.gz llvm-b7fdaf2cd403e99f3079efafc1793e3e7868a245.tar.bz2 |
[llvm-cov] Make report metrics agree with line exec counts, fixes PR34615
Use the same logic as the line-oriented coverage view to determine the
number of covered lines in a function.
Fixes llvm.org/PR34615.
llvm-svn: 313604
Diffstat (limited to 'llvm/tools/llvm-cov/SourceCoverageView.cpp')
-rw-r--r-- | llvm/tools/llvm-cov/SourceCoverageView.cpp | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/llvm/tools/llvm-cov/SourceCoverageView.cpp b/llvm/tools/llvm-cov/SourceCoverageView.cpp index 1965595..dc00b80 100644 --- a/llvm/tools/llvm-cov/SourceCoverageView.cpp +++ b/llvm/tools/llvm-cov/SourceCoverageView.cpp @@ -83,50 +83,6 @@ CoveragePrinter::create(const CoverageViewOptions &Opts) { llvm_unreachable("Unknown coverage output format!"); } -LineCoverageStats::LineCoverageStats( - ArrayRef<const coverage::CoverageSegment *> LineSegments, - const coverage::CoverageSegment *WrappedSegment) { - // Find the minimum number of regions which start in this line. - unsigned MinRegionCount = 0; - auto isStartOfRegion = [](const coverage::CoverageSegment *S) { - return !S->IsGapRegion && S->HasCount && S->IsRegionEntry; - }; - for (unsigned I = 0; I < LineSegments.size() && MinRegionCount < 2; ++I) - if (isStartOfRegion(LineSegments[I])) - ++MinRegionCount; - - bool StartOfSkippedRegion = !LineSegments.empty() && - !LineSegments.front()->HasCount && - LineSegments.front()->IsRegionEntry; - - ExecutionCount = 0; - HasMultipleRegions = MinRegionCount > 1; - Mapped = - !StartOfSkippedRegion && - ((WrappedSegment && WrappedSegment->HasCount) || (MinRegionCount > 0)); - - if (!Mapped) - return; - - // Pick the max count among regions which start and end on this line, to - // avoid erroneously using the wrapped count, and to avoid picking region - // counts which come from deferred regions. - if (LineSegments.size() > 1) { - for (unsigned I = 0; I < LineSegments.size() - 1; ++I) { - if (!LineSegments[I]->IsGapRegion) - ExecutionCount = std::max(ExecutionCount, LineSegments[I]->Count); - } - return; - } - - // If a non-gap region starts here, use its count. Otherwise use the wrapped - // count. - if (MinRegionCount == 1) - ExecutionCount = LineSegments[0]->Count; - else - ExecutionCount = WrappedSegment->Count; -} - unsigned SourceCoverageView::getFirstUncoveredLineNo() { const auto MinSegIt = find_if(CoverageInfo, [](const coverage::CoverageSegment &S) { |