diff options
Diffstat (limited to 'llvm/lib/ProfileData/GCOV.cpp')
| -rw-r--r-- | llvm/lib/ProfileData/GCOV.cpp | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/llvm/lib/ProfileData/GCOV.cpp b/llvm/lib/ProfileData/GCOV.cpp index ecb12c045b5b..7d0a243d0238 100644 --- a/llvm/lib/ProfileData/GCOV.cpp +++ b/llvm/lib/ProfileData/GCOV.cpp @@ -191,7 +191,7 @@ bool GCOVFile::readGCNO(GCOVBuffer &buf) { buf.readString(filename); if (filename.empty()) break; - // TODO Unhandled + Block.addFile(addNormalizedPathToMap(filename)); } } } @@ -456,11 +456,13 @@ void GCOVBlock::print(raw_ostream &OS) const { } OS << "\n"; } - if (!lines.empty()) { - OS << "\tLines : "; - for (uint32_t N : lines) - OS << (N) << ","; - OS << "\n"; + if (!locations.empty()) { + for (const GCOVBlockLocation &loc : locations) { + OS << "\tFile: " << loc.srcIdx << ": "; + for (uint32_t N : loc.lines) + OS << (N) << ","; + OS << "\n"; + } } } @@ -701,20 +703,25 @@ void Context::collectFunction(GCOVFunction &f, Summary &summary) { SmallSet<uint32_t, 16> lines; SmallSet<uint32_t, 16> linesExec; for (const GCOVBlock &b : f.blocksRange()) { - if (b.lines.empty()) + if (b.locations.empty()) continue; - uint32_t maxLineNum = *llvm::max_element(b.lines); - if (maxLineNum >= si.lines.size()) - si.lines.resize(maxLineNum + 1); - for (uint32_t lineNum : b.lines) { - LineInfo &line = si.lines[lineNum]; - if (lines.insert(lineNum).second) - ++summary.lines; - if (b.count && linesExec.insert(lineNum).second) - ++summary.linesExec; - line.exists = true; - line.count += b.count; - line.blocks.push_back(&b); + for (const GCOVBlockLocation &loc : b.locations) { + SourceInfo &locSource = sources[loc.srcIdx]; + uint32_t maxLineNum = *llvm::max_element(loc.lines); + if (maxLineNum >= locSource.lines.size()) + locSource.lines.resize(maxLineNum + 1); + for (uint32_t lineNum : loc.lines) { + LineInfo &line = locSource.lines[lineNum]; + line.exists = true; + line.count += b.count; + line.blocks.push_back(&b); + if (f.srcIdx == loc.srcIdx) { + if (lines.insert(lineNum).second) + ++summary.lines; + if (b.count && linesExec.insert(lineNum).second) + ++summary.linesExec; + } + } } } } |
