summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2014-11-14 01:50:32 +0000
committerJustin Bogner <mail@justinbogner.com>2014-11-14 01:50:32 +0000
commitd5fca9242501b708483efaf62e0f8ad86518569d (patch)
tree84c6ed701289d60c52295c1082088d691ab1c043 /llvm/lib
parentd3be12a6c7e89955d6f528a7ba3d1966309b7853 (diff)
downloadbcm5719-llvm-d5fca9242501b708483efaf62e0f8ad86518569d.tar.gz
bcm5719-llvm-d5fca9242501b708483efaf62e0f8ad86518569d.zip
llvm-cov: Sink some reporting logic into CoverageMapping
This teaches CoverageMapping::getCoveredFunctions to filter to a particular file and uses that to replace most of the logic found in llvm-cov report. llvm-svn: 221962
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/ProfileData/CoverageMapping.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/ProfileData/CoverageMapping.cpp b/llvm/lib/ProfileData/CoverageMapping.cpp
index c7dba2c1340..0ccebc2b97e 100644
--- a/llvm/lib/ProfileData/CoverageMapping.cpp
+++ b/llvm/lib/ProfileData/CoverageMapping.cpp
@@ -170,6 +170,14 @@ ErrorOr<int64_t> CounterMappingContext::evaluate(const Counter &C) const {
llvm_unreachable("Unhandled CounterKind");
}
+void FunctionRecordIterator::skipOtherFiles() {
+ while (Current != Records.end() && !Filename.empty() &&
+ Filename != Current->Filenames[0])
+ ++Current;
+ if (Current == Records.end())
+ *this = FunctionRecordIterator();
+}
+
ErrorOr<std::unique_ptr<CoverageMapping>>
CoverageMapping::load(ObjectFileCoverageMappingReader &CoverageReader,
IndexedInstrProfReader &ProfileReader) {
@@ -320,7 +328,7 @@ public:
};
}
-std::vector<StringRef> CoverageMapping::getUniqueSourceFiles() {
+std::vector<StringRef> CoverageMapping::getUniqueSourceFiles() const {
std::vector<StringRef> Filenames;
for (const auto &Function : getCoveredFunctions())
for (const auto &Filename : Function.Filenames)
OpenPOWER on IntegriCloud