diff options
| author | Vedant Kumar <vsk@apple.com> | 2017-10-19 06:16:23 +0000 |
|---|---|---|
| committer | Vedant Kumar <vsk@apple.com> | 2017-10-19 06:16:23 +0000 |
| commit | f5f153dd6f1944c4bcca4a1485df3098eef13096 (patch) | |
| tree | ae7e6567d845e8690c699f012b5e7d1c5e70b6cb /llvm | |
| parent | 3612d4b4f9df25d11b8ab64109ea5450eef2439a (diff) | |
| download | bcm5719-llvm-f5f153dd6f1944c4bcca4a1485df3098eef13096.tar.gz bcm5719-llvm-f5f153dd6f1944c4bcca4a1485df3098eef13096.zip | |
[Coverage] Simplify r316141. NFC.
llvm-svn: 316147
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/ProfileData/Coverage/CoverageMapping.cpp | 6 | ||||
| -rw-r--r-- | llvm/unittests/ProfileData/CoverageMappingTest.cpp | 47 |
2 files changed, 9 insertions, 44 deletions
diff --git a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp index bda61768e7b..5542cc89f6b 100644 --- a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp +++ b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp @@ -672,13 +672,13 @@ CoverageData CoverageMapping::getCoverageForExpansion( } LineCoverageStats::LineCoverageStats( - ArrayRef<const coverage::CoverageSegment *> LineSegments, - const coverage::CoverageSegment *WrappedSegment, unsigned Line) + ArrayRef<const CoverageSegment *> LineSegments, + const CoverageSegment *WrappedSegment, unsigned Line) : ExecutionCount(0), HasMultipleRegions(false), Mapped(false), Line(Line), LineSegments(LineSegments), WrappedSegment(WrappedSegment) { // Find the minimum number of regions which start in this line. unsigned MinRegionCount = 0; - auto isStartOfRegion = [](const coverage::CoverageSegment *S) { + auto isStartOfRegion = [](const CoverageSegment *S) { return !S->IsGapRegion && S->HasCount && S->IsRegionEntry; }; for (unsigned I = 0; I < LineSegments.size() && MinRegionCount < 2; ++I) diff --git a/llvm/unittests/ProfileData/CoverageMappingTest.cpp b/llvm/unittests/ProfileData/CoverageMappingTest.cpp index ad0a0cfb873..ce52c6f93ee 100644 --- a/llvm/unittests/ProfileData/CoverageMappingTest.cpp +++ b/llvm/unittests/ProfileData/CoverageMappingTest.cpp @@ -647,49 +647,14 @@ TEST_P(CoverageMappingTest, test_line_coverage_iterator) { CoverageData Data = LoadedCoverage->getCoverageForFile("file1"); - unsigned NumLineStats = 0; + unsigned Line = 0; + unsigned LineCounts[] = {20, 20, 20, 20, 10, 10, 10, 10, 10, 0, 0}; for (const auto &LCS : getLineCoverageStats(Data)) { - ++NumLineStats; - (void)LCS; + ASSERT_EQ(Line + 1, LCS.getLine()); + ASSERT_EQ(LineCounts[Line], LCS.getExecutionCount()); + ++Line; } - ASSERT_EQ(11U, NumLineStats); - - LineCoverageIterator LCI{Data}; - - ASSERT_EQ(1U, LCI->getLine()); - ASSERT_EQ(20ULL, LCI->getExecutionCount()); - ++LCI; - ASSERT_EQ(2U, LCI->getLine()); - ASSERT_EQ(20ULL, LCI->getExecutionCount()); - ++LCI; - ASSERT_EQ(3U, LCI->getLine()); - ASSERT_EQ(20ULL, LCI->getExecutionCount()); - ++LCI; - ASSERT_EQ(4U, LCI->getLine()); - ASSERT_EQ(20ULL, LCI->getExecutionCount()); - ++LCI; - ASSERT_EQ(5U, LCI->getLine()); - ASSERT_EQ(10ULL, LCI->getExecutionCount()); - ++LCI; - ASSERT_EQ(6U, LCI->getLine()); - ASSERT_EQ(10ULL, LCI->getExecutionCount()); - ++LCI; - ASSERT_EQ(7U, LCI->getLine()); - ASSERT_EQ(10ULL, LCI->getExecutionCount()); - ++LCI; - ASSERT_EQ(8U, LCI->getLine()); - ASSERT_EQ(10ULL, LCI->getExecutionCount()); - ++LCI; - ASSERT_EQ(9U, LCI->getLine()); - ASSERT_EQ(10ULL, LCI->getExecutionCount()); - ++LCI; - ASSERT_EQ(10U, LCI->getLine()); - ASSERT_EQ(0ULL, LCI->getExecutionCount()); - ++LCI; - ASSERT_EQ(11U, LCI->getLine()); - ASSERT_EQ(0ULL, LCI->getExecutionCount()); - ++LCI; - ASSERT_EQ(LCI, LCI.getEnd()); + ASSERT_EQ(11U, Line); } TEST_P(CoverageMappingTest, uncovered_function) { |

