summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ProfileData/CoverageMappingTest.cpp
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2015-05-05 23:44:48 +0000
committerJustin Bogner <mail@justinbogner.com>2015-05-05 23:44:48 +0000
commit0b4c484fb9c0e0ae3935800c00cf0d39410374c3 (patch)
treec6687c079303844626e26a73287bb90ae96cb18b /llvm/unittests/ProfileData/CoverageMappingTest.cpp
parentd0dae3e5776b762e2848066eb12d6243190922fc (diff)
downloadbcm5719-llvm-0b4c484fb9c0e0ae3935800c00cf0d39410374c3.tar.gz
bcm5719-llvm-0b4c484fb9c0e0ae3935800c00cf0d39410374c3.zip
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
Diffstat (limited to 'llvm/unittests/ProfileData/CoverageMappingTest.cpp')
-rw-r--r--llvm/unittests/ProfileData/CoverageMappingTest.cpp14
1 files changed, 14 insertions, 0 deletions
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<std::string> 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
OpenPOWER on IntegriCloud