1 //===- GCOV.cpp - LLVM coverage tool --------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // GCOV implements the interface to read and write coverage files that use
13 //===----------------------------------------------------------------------===//
15 #include "llvm/Support/GCOV.h"
16 #include "llvm/ADT/STLExtras.h"
17 #include "llvm/Support/Debug.h"
18 #include "llvm/Support/FileSystem.h"
19 #include "llvm/Support/Format.h"
20 #include "llvm/Support/MemoryObject.h"
21 #include "llvm/Support/Path.h"
23 #include <system_error>
26 //===----------------------------------------------------------------------===//
27 // GCOVFile implementation.
29 /// readGCNO - Read GCNO buffer.
30 bool GCOVFile::readGCNO(GCOVBuffer &Buffer) {
31 if (!Buffer.readGCNOFormat())
33 if (!Buffer.readGCOVVersion(Version))
36 if (!Buffer.readInt(Checksum))
39 if (!Buffer.readFunctionTag())
41 auto GFun = make_unique<GCOVFunction>(*this);
42 if (!GFun->readGCNO(Buffer, Version))
44 Functions.push_back(std::move(GFun));
47 GCNOInitialized = true;
51 /// readGCDA - Read GCDA buffer. It is required that readGCDA() can only be
52 /// called after readGCNO().
53 bool GCOVFile::readGCDA(GCOVBuffer &Buffer) {
54 assert(GCNOInitialized && "readGCDA() can only be called after readGCNO()");
55 if (!Buffer.readGCDAFormat())
57 GCOV::GCOVVersion GCDAVersion;
58 if (!Buffer.readGCOVVersion(GCDAVersion))
60 if (Version != GCDAVersion) {
61 errs() << "GCOV versions do not match.\n";
65 uint32_t GCDAChecksum;
66 if (!Buffer.readInt(GCDAChecksum))
68 if (Checksum != GCDAChecksum) {
69 errs() << "File checksums do not match: " << Checksum
70 << " != " << GCDAChecksum << ".\n";
73 for (size_t i = 0, e = Functions.size(); i < e; ++i) {
74 if (!Buffer.readFunctionTag()) {
75 errs() << "Unexpected number of functions.\n";
78 if (!Functions[i]->readGCDA(Buffer, Version))
81 if (Buffer.readObjectTag()) {
84 if (!Buffer.readInt(Length))
86 if (!Buffer.readInt(Dummy))
87 return false; // checksum
88 if (!Buffer.readInt(Dummy))
90 if (!Buffer.readInt(RunCount))
92 Buffer.advanceCursor(Length - 3);
94 while (Buffer.readProgramTag()) {
96 if (!Buffer.readInt(Length))
98 Buffer.advanceCursor(Length);
105 /// dump - Dump GCOVFile content to dbgs() for debugging purposes.
106 void GCOVFile::dump() const {
107 for (const auto &FPtr : Functions)
111 /// collectLineCounts - Collect line counts. This must be used after
112 /// reading .gcno and .gcda files.
113 void GCOVFile::collectLineCounts(FileInfo &FI) {
114 for (const auto &FPtr : Functions)
115 FPtr->collectLineCounts(FI);
116 FI.setRunCount(RunCount);
117 FI.setProgramCount(ProgramCount);
120 //===----------------------------------------------------------------------===//
121 // GCOVFunction implementation.
123 /// readGCNO - Read a function from the GCNO buffer. Return false if an error
125 bool GCOVFunction::readGCNO(GCOVBuffer &Buff, GCOV::GCOVVersion Version) {
127 if (!Buff.readInt(Dummy))
128 return false; // Function header length
129 if (!Buff.readInt(Ident))
131 if (!Buff.readInt(Checksum))
133 if (Version != GCOV::V402) {
134 uint32_t CfgChecksum;
135 if (!Buff.readInt(CfgChecksum))
137 if (Parent.getChecksum() != CfgChecksum) {
138 errs() << "File checksums do not match: " << Parent.getChecksum()
139 << " != " << CfgChecksum << " in (" << Name << ").\n";
143 if (!Buff.readString(Name))
145 if (!Buff.readString(Filename))
147 if (!Buff.readInt(LineNumber))
151 if (!Buff.readBlockTag()) {
152 errs() << "Block tag not found.\n";
156 if (!Buff.readInt(BlockCount))
158 for (uint32_t i = 0, e = BlockCount; i != e; ++i) {
159 if (!Buff.readInt(Dummy))
160 return false; // Block flags;
161 Blocks.push_back(make_unique<GCOVBlock>(*this, i));
165 while (Buff.readEdgeTag()) {
167 if (!Buff.readInt(EdgeCount))
169 EdgeCount = (EdgeCount - 1) / 2;
171 if (!Buff.readInt(BlockNo))
173 if (BlockNo >= BlockCount) {
174 errs() << "Unexpected block number: " << BlockNo << " (in " << Name
178 for (uint32_t i = 0, e = EdgeCount; i != e; ++i) {
180 if (!Buff.readInt(Dst))
182 Edges.push_back(make_unique<GCOVEdge>(*Blocks[BlockNo], *Blocks[Dst]));
183 GCOVEdge *Edge = Edges.back().get();
184 Blocks[BlockNo]->addDstEdge(Edge);
185 Blocks[Dst]->addSrcEdge(Edge);
186 if (!Buff.readInt(Dummy))
187 return false; // Edge flag
192 while (Buff.readLineTag()) {
193 uint32_t LineTableLength;
194 // Read the length of this line table.
195 if (!Buff.readInt(LineTableLength))
197 uint32_t EndPos = Buff.getCursor() + LineTableLength * 4;
199 // Read the block number this table is associated with.
200 if (!Buff.readInt(BlockNo))
202 if (BlockNo >= BlockCount) {
203 errs() << "Unexpected block number: " << BlockNo << " (in " << Name
207 GCOVBlock &Block = *Blocks[BlockNo];
208 // Read the word that pads the beginning of the line table. This may be a
209 // flag of some sort, but seems to always be zero.
210 if (!Buff.readInt(Dummy))
213 // Line information starts here and continues up until the last word.
214 if (Buff.getCursor() != (EndPos - sizeof(uint32_t))) {
216 // Read the source file name.
217 if (!Buff.readString(F))
220 errs() << "Multiple sources for a single basic block: " << Filename
221 << " != " << F << " (in " << Name << ").\n";
224 // Read lines up to, but not including, the null terminator.
225 while (Buff.getCursor() < (EndPos - 2 * sizeof(uint32_t))) {
227 if (!Buff.readInt(Line))
229 // Line 0 means this instruction was injected by the compiler. Skip it.
234 // Read the null terminator.
235 if (!Buff.readInt(Dummy))
238 // The last word is either a flag or padding, it isn't clear which. Skip
240 if (!Buff.readInt(Dummy))
246 /// readGCDA - Read a function from the GCDA buffer. Return false if an error
248 bool GCOVFunction::readGCDA(GCOVBuffer &Buff, GCOV::GCOVVersion Version) {
250 if (!Buff.readInt(Dummy))
251 return false; // Function header length
254 if (!Buff.readInt(GCDAIdent))
256 if (Ident != GCDAIdent) {
257 errs() << "Function identifiers do not match: " << Ident
258 << " != " << GCDAIdent << " (in " << Name << ").\n";
262 uint32_t GCDAChecksum;
263 if (!Buff.readInt(GCDAChecksum))
265 if (Checksum != GCDAChecksum) {
266 errs() << "Function checksums do not match: " << Checksum
267 << " != " << GCDAChecksum << " (in " << Name << ").\n";
271 uint32_t CfgChecksum;
272 if (Version != GCOV::V402) {
273 if (!Buff.readInt(CfgChecksum))
275 if (Parent.getChecksum() != CfgChecksum) {
276 errs() << "File checksums do not match: " << Parent.getChecksum()
277 << " != " << CfgChecksum << " (in " << Name << ").\n";
283 if (!Buff.readString(GCDAName))
285 if (Name != GCDAName) {
286 errs() << "Function names do not match: " << Name << " != " << GCDAName
291 if (!Buff.readArcTag()) {
292 errs() << "Arc tag not found (in " << Name << ").\n";
297 if (!Buff.readInt(Count))
301 // This for loop adds the counts for each block. A second nested loop is
302 // required to combine the edge counts that are contained in the GCDA file.
303 for (uint32_t BlockNo = 0; Count > 0; ++BlockNo) {
304 // The last block is always reserved for exit block
305 if (BlockNo >= Blocks.size() - 1) {
306 errs() << "Unexpected number of edges (in " << Name << ").\n";
309 GCOVBlock &Block = *Blocks[BlockNo];
310 for (size_t EdgeNo = 0, End = Block.getNumDstEdges(); EdgeNo < End;
313 errs() << "Unexpected number of edges (in " << Name << ").\n";
317 if (!Buff.readInt64(ArcCount))
319 Block.addCount(EdgeNo, ArcCount);
322 Block.sortDstEdges();
327 /// getEntryCount - Get the number of times the function was called by
328 /// retrieving the entry block's count.
329 uint64_t GCOVFunction::getEntryCount() const {
330 return Blocks.front()->getCount();
333 /// getExitCount - Get the number of times the function returned by retrieving
334 /// the exit block's count.
335 uint64_t GCOVFunction::getExitCount() const {
336 return Blocks.back()->getCount();
339 /// dump - Dump GCOVFunction content to dbgs() for debugging purposes.
340 void GCOVFunction::dump() const {
341 dbgs() << "===== " << Name << " (" << Ident << ") @ " << Filename << ":"
342 << LineNumber << "\n";
343 for (const auto &Block : Blocks)
347 /// collectLineCounts - Collect line counts. This must be used after
348 /// reading .gcno and .gcda files.
349 void GCOVFunction::collectLineCounts(FileInfo &FI) {
350 // If the line number is zero, this is a function that doesn't actually appear
351 // in the source file, so there isn't anything we can do with it.
355 for (const auto &Block : Blocks)
356 Block->collectLineCounts(FI);
357 FI.addFunctionLine(Filename, LineNumber, this);
360 //===----------------------------------------------------------------------===//
361 // GCOVBlock implementation.
363 /// ~GCOVBlock - Delete GCOVBlock and its content.
364 GCOVBlock::~GCOVBlock() {
370 /// addCount - Add to block counter while storing the edge count. If the
371 /// destination has no outgoing edges, also update that block's count too.
372 void GCOVBlock::addCount(size_t DstEdgeNo, uint64_t N) {
373 assert(DstEdgeNo < DstEdges.size()); // up to caller to ensure EdgeNo is valid
374 DstEdges[DstEdgeNo]->Count = N;
376 if (!DstEdges[DstEdgeNo]->Dst.getNumDstEdges())
377 DstEdges[DstEdgeNo]->Dst.Counter += N;
380 /// sortDstEdges - Sort destination edges by block number, nop if already
381 /// sorted. This is required for printing branch info in the correct order.
382 void GCOVBlock::sortDstEdges() {
383 if (!DstEdgesAreSorted) {
384 SortDstEdgesFunctor SortEdges;
385 std::stable_sort(DstEdges.begin(), DstEdges.end(), SortEdges);
389 /// collectLineCounts - Collect line counts. This must be used after
390 /// reading .gcno and .gcda files.
391 void GCOVBlock::collectLineCounts(FileInfo &FI) {
392 for (auto I = Lines.begin(), E = Lines.end(); I != E; ++I)
393 FI.addBlockLine(Parent.getFilename(), *I, this);
396 /// dump - Dump GCOVBlock content to dbgs() for debugging purposes.
397 void GCOVBlock::dump() const {
398 dbgs() << "Block : " << Number << " Counter : " << Counter << "\n";
399 if (!SrcEdges.empty()) {
400 dbgs() << "\tSource Edges : ";
401 for (EdgeIterator I = SrcEdges.begin(), E = SrcEdges.end(); I != E; ++I) {
402 const GCOVEdge *Edge = *I;
403 dbgs() << Edge->Src.Number << " (" << Edge->Count << "), ";
407 if (!DstEdges.empty()) {
408 dbgs() << "\tDestination Edges : ";
409 for (EdgeIterator I = DstEdges.begin(), E = DstEdges.end(); I != E; ++I) {
410 const GCOVEdge *Edge = *I;
411 dbgs() << Edge->Dst.Number << " (" << Edge->Count << "), ";
415 if (!Lines.empty()) {
416 dbgs() << "\tLines : ";
417 for (SmallVectorImpl<uint32_t>::const_iterator I = Lines.begin(),
420 dbgs() << (*I) << ",";
425 //===----------------------------------------------------------------------===//
426 // FileInfo implementation.
428 // Safe integer division, returns 0 if numerator is 0.
429 static uint32_t safeDiv(uint64_t Numerator, uint64_t Divisor) {
432 return Numerator / Divisor;
435 // This custom division function mimics gcov's branch ouputs:
436 // - Round to closest whole number
437 // - Only output 0% or 100% if it's exactly that value
438 static uint32_t branchDiv(uint64_t Numerator, uint64_t Divisor) {
441 if (Numerator == Divisor)
444 uint8_t Res = (Numerator * 100 + Divisor / 2) / Divisor;
452 struct formatBranchInfo {
453 formatBranchInfo(const GCOVOptions &Options, uint64_t Count, uint64_t Total)
454 : Options(Options), Count(Count), Total(Total) {}
456 void print(raw_ostream &OS) const {
458 OS << "never executed";
459 else if (Options.BranchCount)
460 OS << "taken " << Count;
462 OS << "taken " << branchDiv(Count, Total) << "%";
465 const GCOVOptions &Options;
470 static raw_ostream &operator<<(raw_ostream &OS, const formatBranchInfo &FBI) {
477 std::unique_ptr<MemoryBuffer> Buffer;
481 LineConsumer(StringRef Filename) {
482 ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr =
483 MemoryBuffer::getFileOrSTDIN(Filename);
484 if (std::error_code EC = BufferOrErr.getError()) {
485 errs() << Filename << ": " << EC.message() << "\n";
488 Buffer = std::move(BufferOrErr.get());
489 Remaining = Buffer->getBuffer();
492 bool empty() { return Remaining.empty(); }
493 void printNext(raw_ostream &OS, uint32_t LineNum) {
498 std::tie(Line, Remaining) = Remaining.split("\n");
499 OS << format("%5u:", LineNum) << Line << "\n";
504 /// Convert a path to a gcov filename. If PreservePaths is true, this
505 /// translates "/" to "#", ".." to "^", and drops ".", to match gcov.
506 static std::string mangleCoveragePath(StringRef Filename, bool PreservePaths) {
508 return sys::path::filename(Filename).str();
510 // This behaviour is defined by gcov in terms of text replacements, so it's
511 // not likely to do anything useful on filesystems with different textual
513 llvm::SmallString<256> Result("");
514 StringRef::iterator I, S, E;
515 for (I = S = Filename.begin(), E = Filename.end(); I != E; ++I) {
519 if (I - S == 1 && *S == '.') {
520 // ".", the current directory, is skipped.
521 } else if (I - S == 2 && *S == '.' && *(S + 1) == '.') {
522 // "..", the parent directory, is replaced with "^".
526 // Leave other components intact,
528 // And separate with "#".
529 Result.push_back('#');
539 std::string FileInfo::getCoveragePath(StringRef Filename,
540 StringRef MainFilename) {
541 if (Options.NoOutput)
542 // This is probably a bug in gcov, but when -n is specified, paths aren't
543 // mangled at all, and the -l and -p options are ignored. Here, we do the
547 std::string CoveragePath;
548 if (Options.LongFileNames && !Filename.equals(MainFilename))
550 mangleCoveragePath(MainFilename, Options.PreservePaths) + "##";
551 CoveragePath += mangleCoveragePath(Filename, Options.PreservePaths) + ".gcov";
555 std::unique_ptr<raw_ostream>
556 FileInfo::openCoveragePath(StringRef CoveragePath) {
557 if (Options.NoOutput)
558 return llvm::make_unique<raw_null_ostream>();
561 auto OS = llvm::make_unique<raw_fd_ostream>(CoveragePath.str(), EC,
564 errs() << EC.message() << "\n";
565 return llvm::make_unique<raw_null_ostream>();
567 return std::move(OS);
570 /// print - Print source files with collected line count information.
571 void FileInfo::print(StringRef MainFilename, StringRef GCNOFile,
572 StringRef GCDAFile) {
573 for (StringMap<LineData>::const_iterator I = LineInfo.begin(),
576 StringRef Filename = I->first();
577 auto AllLines = LineConsumer(Filename);
579 std::string CoveragePath = getCoveragePath(Filename, MainFilename);
580 std::unique_ptr<raw_ostream> S = openCoveragePath(CoveragePath);
581 raw_ostream &OS = *S;
583 OS << " -: 0:Source:" << Filename << "\n";
584 OS << " -: 0:Graph:" << GCNOFile << "\n";
585 OS << " -: 0:Data:" << GCDAFile << "\n";
586 OS << " -: 0:Runs:" << RunCount << "\n";
587 OS << " -: 0:Programs:" << ProgramCount << "\n";
589 const LineData &Line = I->second;
590 GCOVCoverage FileCoverage(Filename);
591 for (uint32_t LineIndex = 0; LineIndex < Line.LastLine || !AllLines.empty();
593 if (Options.BranchInfo) {
594 FunctionLines::const_iterator FuncsIt = Line.Functions.find(LineIndex);
595 if (FuncsIt != Line.Functions.end())
596 printFunctionSummary(OS, FuncsIt->second);
599 BlockLines::const_iterator BlocksIt = Line.Blocks.find(LineIndex);
600 if (BlocksIt == Line.Blocks.end()) {
601 // No basic blocks are on this line. Not an executable line of code.
603 AllLines.printNext(OS, LineIndex + 1);
605 const BlockVector &Blocks = BlocksIt->second;
607 // Add up the block counts to form line counts.
608 DenseMap<const GCOVFunction *, bool> LineExecs;
609 uint64_t LineCount = 0;
610 for (BlockVector::const_iterator I = Blocks.begin(), E = Blocks.end();
612 const GCOVBlock *Block = *I;
613 if (Options.AllBlocks) {
614 // Only take the highest block count for that line.
615 uint64_t BlockCount = Block->getCount();
616 LineCount = LineCount > BlockCount ? LineCount : BlockCount;
618 // Sum up all of the block counts.
619 LineCount += Block->getCount();
622 if (Options.FuncCoverage) {
623 // This is a slightly convoluted way to most accurately gather line
624 // statistics for functions. Basically what is happening is that we
625 // don't want to count a single line with multiple blocks more than
626 // once. However, we also don't simply want to give the total line
627 // count to every function that starts on the line. Thus, what is
628 // happening here are two things:
629 // 1) Ensure that the number of logical lines is only incremented
630 // once per function.
631 // 2) If there are multiple blocks on the same line, ensure that the
632 // number of lines executed is incremented as long as at least
633 // one of the blocks are executed.
634 const GCOVFunction *Function = &Block->getParent();
635 if (FuncCoverages.find(Function) == FuncCoverages.end()) {
636 std::pair<const GCOVFunction *, GCOVCoverage> KeyValue(
637 Function, GCOVCoverage(Function->getName()));
638 FuncCoverages.insert(KeyValue);
640 GCOVCoverage &FuncCoverage = FuncCoverages.find(Function)->second;
642 if (LineExecs.find(Function) == LineExecs.end()) {
643 if (Block->getCount()) {
644 ++FuncCoverage.LinesExec;
645 LineExecs[Function] = true;
647 LineExecs[Function] = false;
649 ++FuncCoverage.LogicalLines;
650 } else if (!LineExecs[Function] && Block->getCount()) {
651 ++FuncCoverage.LinesExec;
652 LineExecs[Function] = true;
660 OS << format("%9" PRIu64 ":", LineCount);
661 ++FileCoverage.LinesExec;
663 ++FileCoverage.LogicalLines;
665 AllLines.printNext(OS, LineIndex + 1);
667 uint32_t BlockNo = 0;
669 for (BlockVector::const_iterator I = Blocks.begin(), E = Blocks.end();
671 const GCOVBlock *Block = *I;
673 // Only print block and branch information at the end of the block.
674 if (Block->getLastLine() != LineIndex + 1)
676 if (Options.AllBlocks)
677 printBlockInfo(OS, *Block, LineIndex, BlockNo);
678 if (Options.BranchInfo) {
679 size_t NumEdges = Block->getNumDstEdges();
681 printBranchInfo(OS, *Block, FileCoverage, EdgeNo);
682 else if (Options.UncondBranch && NumEdges == 1)
683 printUncondBranchInfo(OS, EdgeNo, (*Block->dst_begin())->Count);
688 FileCoverages.push_back(std::make_pair(CoveragePath, FileCoverage));
691 // FIXME: There is no way to detect calls given current instrumentation.
692 if (Options.FuncCoverage)
698 /// printFunctionSummary - Print function and block summary.
699 void FileInfo::printFunctionSummary(raw_ostream &OS,
700 const FunctionVector &Funcs) const {
701 for (FunctionVector::const_iterator I = Funcs.begin(), E = Funcs.end();
703 const GCOVFunction *Func = *I;
704 uint64_t EntryCount = Func->getEntryCount();
705 uint32_t BlocksExec = 0;
706 for (GCOVFunction::BlockIterator I = Func->block_begin(),
707 E = Func->block_end();
709 const GCOVBlock &Block = **I;
710 if (Block.getNumDstEdges() && Block.getCount())
714 OS << "function " << Func->getName() << " called " << EntryCount
715 << " returned " << safeDiv(Func->getExitCount() * 100, EntryCount)
716 << "% blocks executed "
717 << safeDiv(BlocksExec * 100, Func->getNumBlocks() - 1) << "%\n";
721 /// printBlockInfo - Output counts for each block.
722 void FileInfo::printBlockInfo(raw_ostream &OS, const GCOVBlock &Block,
723 uint32_t LineIndex, uint32_t &BlockNo) const {
724 if (Block.getCount() == 0)
727 OS << format("%9" PRIu64 ":", Block.getCount());
728 OS << format("%5u-block %2u\n", LineIndex + 1, BlockNo++);
731 /// printBranchInfo - Print conditional branch probabilities.
732 void FileInfo::printBranchInfo(raw_ostream &OS, const GCOVBlock &Block,
733 GCOVCoverage &Coverage, uint32_t &EdgeNo) {
734 SmallVector<uint64_t, 16> BranchCounts;
735 uint64_t TotalCounts = 0;
736 for (GCOVBlock::EdgeIterator I = Block.dst_begin(), E = Block.dst_end();
738 const GCOVEdge *Edge = *I;
739 BranchCounts.push_back(Edge->Count);
740 TotalCounts += Edge->Count;
741 if (Block.getCount())
742 ++Coverage.BranchesExec;
744 ++Coverage.BranchesTaken;
747 if (Options.FuncCoverage) {
748 const GCOVFunction *Function = &Block.getParent();
749 GCOVCoverage &FuncCoverage = FuncCoverages.find(Function)->second;
750 if (Block.getCount())
751 ++FuncCoverage.BranchesExec;
753 ++FuncCoverage.BranchesTaken;
754 ++FuncCoverage.Branches;
758 for (SmallVectorImpl<uint64_t>::const_iterator I = BranchCounts.begin(),
759 E = BranchCounts.end();
761 OS << format("branch %2u ", EdgeNo++)
762 << formatBranchInfo(Options, *I, TotalCounts) << "\n";
766 /// printUncondBranchInfo - Print unconditional branch probabilities.
767 void FileInfo::printUncondBranchInfo(raw_ostream &OS, uint32_t &EdgeNo,
768 uint64_t Count) const {
769 OS << format("unconditional %2u ", EdgeNo++)
770 << formatBranchInfo(Options, Count, Count) << "\n";
773 // printCoverage - Print generic coverage info used by both printFuncCoverage
774 // and printFileCoverage.
775 void FileInfo::printCoverage(const GCOVCoverage &Coverage) const {
776 outs() << format("Lines executed:%.2f%% of %u\n",
777 double(Coverage.LinesExec) * 100 / Coverage.LogicalLines,
778 Coverage.LogicalLines);
779 if (Options.BranchInfo) {
780 if (Coverage.Branches) {
781 outs() << format("Branches executed:%.2f%% of %u\n",
782 double(Coverage.BranchesExec) * 100 / Coverage.Branches,
784 outs() << format("Taken at least once:%.2f%% of %u\n",
785 double(Coverage.BranchesTaken) * 100 / Coverage.Branches,
788 outs() << "No branches\n";
790 outs() << "No calls\n"; // to be consistent with gcov
794 // printFuncCoverage - Print per-function coverage info.
795 void FileInfo::printFuncCoverage() const {
796 for (FuncCoverageMap::const_iterator I = FuncCoverages.begin(),
797 E = FuncCoverages.end();
799 const GCOVCoverage &Coverage = I->second;
800 outs() << "Function '" << Coverage.Name << "'\n";
801 printCoverage(Coverage);
806 // printFileCoverage - Print per-file coverage info.
807 void FileInfo::printFileCoverage() const {
808 for (FileCoverageList::const_iterator I = FileCoverages.begin(),
809 E = FileCoverages.end();
811 const std::string &Filename = I->first;
812 const GCOVCoverage &Coverage = I->second;
813 outs() << "File '" << Coverage.Name << "'\n";
814 printCoverage(Coverage);
815 if (!Options.NoOutput)
816 outs() << Coverage.Name << ":creating '" << Filename << "'\n";