diff options
author | Justin Bogner <mail@justinbogner.com> | 2015-02-18 18:40:46 +0000 |
---|---|---|
committer | Justin Bogner <mail@justinbogner.com> | 2015-02-18 18:40:46 +0000 |
commit | 428c605dff38347495060e5df983bbc7df3c67df (patch) | |
tree | 25ae3e1d9ba43a3c4452ab60ce267ade75cd4f44 /llvm/unittests/ProfileData/CoverageMappingTest.cpp | |
parent | 34e79ed319436693870ed27c951bd55267f1a154 (diff) | |
download | bcm5719-llvm-428c605dff38347495060e5df983bbc7df3c67df.tar.gz bcm5719-llvm-428c605dff38347495060e5df983bbc7df3c67df.zip |
InstrProf: Handle unknown functions if they consist only of zero-regions
This comes up when we generate coverage for a function but don't end
up emitting the function at all - dead static functions or inline
functions that aren't referenced in a particular TU, for example. In
these cases we'd like to show that the function was never called,
which is trivially true.
llvm-svn: 229717
Diffstat (limited to 'llvm/unittests/ProfileData/CoverageMappingTest.cpp')
-rw-r--r-- | llvm/unittests/ProfileData/CoverageMappingTest.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/unittests/ProfileData/CoverageMappingTest.cpp b/llvm/unittests/ProfileData/CoverageMappingTest.cpp index d079b479216..5e64843b6d6 100644 --- a/llvm/unittests/ProfileData/CoverageMappingTest.cpp +++ b/llvm/unittests/ProfileData/CoverageMappingTest.cpp @@ -209,4 +209,17 @@ TEST_F(CoverageMappingTest, basic_coverage_iteration) { ASSERT_EQ(CoverageSegment(11, 11, false), Segments[6]); } +TEST_F(CoverageMappingTest, uncovered_function) { + readProfCounts(); + + addCMR(Counter::getZero(), "file1", 1, 2, 3, 4); + loadCoverageMapping("func", 0x1234); + + CoverageData Data = LoadedCoverage->getCoverageForFile("file1"); + std::vector<CoverageSegment> Segments(Data.begin(), Data.end()); + ASSERT_EQ(2U, Segments.size()); + ASSERT_EQ(CoverageSegment(1, 2, 0, true), Segments[0]); + ASSERT_EQ(CoverageSegment(3, 4, false), Segments[1]); +} + } // end anonymous namespace |