From 0b4c484fb9c0e0ae3935800c00cf0d39410374c3 Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Tue, 5 May 2015 23:44:48 +0000 Subject: InstrProf: Strip filename prefixes from the names we display for coverage For consumers of coverage data, any filename prefixes we store in the profile data are just noise. Strip this prefix if it exists. llvm-svn: 236558 --- llvm/unittests/ProfileData/CoverageMappingTest.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'llvm/unittests/ProfileData/CoverageMappingTest.cpp') diff --git a/llvm/unittests/ProfileData/CoverageMappingTest.cpp b/llvm/unittests/ProfileData/CoverageMappingTest.cpp index 9fceacbec89..c82ed66e53e 100644 --- a/llvm/unittests/ProfileData/CoverageMappingTest.cpp +++ b/llvm/unittests/ProfileData/CoverageMappingTest.cpp @@ -259,4 +259,18 @@ TEST_F(CoverageMappingTest, dont_combine_expansions) { ASSERT_EQ(CoverageSegment(9, 9, false), Segments[3]); } +TEST_F(CoverageMappingTest, strip_filename_prefix) { + ProfileWriter.addFunctionCounts("file1:func", 0x1234, {10}); + readProfCounts(); + + addCMR(Counter::getCounter(0), "file1", 1, 1, 9, 9); + loadCoverageMapping("file1:func", 0x1234); + + std::vector Names; + for (const auto &Func : LoadedCoverage->getCoveredFunctions()) + Names.push_back(Func.Name); + ASSERT_EQ(1U, Names.size()); + ASSERT_EQ("func", Names[0]); +} + } // end anonymous namespace -- cgit v1.2.3