1 //===- CodeCoverage.cpp - Coverage tool based on profiling instrumentation-===//
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 // The 'CodeCoverageTool' class implements a command line tool to analyze and
11 // report coverage information using the profiling instrumentation and code
14 //===----------------------------------------------------------------------===//
16 #include "RenderingSupport.h"
17 #include "CoverageViewOptions.h"
18 #include "CoverageFilters.h"
19 #include "SourceCoverageDataManager.h"
20 #include "SourceCoverageView.h"
21 #include "CoverageSummary.h"
22 #include "CoverageReport.h"
23 #include "llvm/ADT/StringRef.h"
24 #include "llvm/ADT/SmallString.h"
25 #include "llvm/ADT/SmallSet.h"
26 #include "llvm/ADT/DenseSet.h"
27 #include "llvm/ProfileData/InstrProfReader.h"
28 #include "llvm/ProfileData/CoverageMapping.h"
29 #include "llvm/ProfileData/CoverageMappingReader.h"
30 #include "llvm/Support/CommandLine.h"
31 #include "llvm/Support/FileSystem.h"
32 #include "llvm/Support/ManagedStatic.h"
33 #include "llvm/Support/MemoryObject.h"
34 #include "llvm/Support/Format.h"
35 #include "llvm/Support/Path.h"
36 #include "llvm/Support/Signals.h"
37 #include "llvm/Support/PrettyStackTrace.h"
39 #include <system_error>
40 #include <unordered_map>
43 using namespace coverage;
46 /// \brief Distribute the functions into instantiation sets.
47 /// An instantiation set is a collection of functions
48 /// that have the same source code, e.g.
49 /// template functions specializations.
50 class FunctionInstantiationSetCollector {
51 ArrayRef<FunctionCoverageMapping> FunctionMappings;
52 typedef uint64_t KeyType;
53 typedef std::vector<const FunctionCoverageMapping *> SetType;
54 std::unordered_map<uint64_t, SetType> InstantiatedFunctions;
56 static KeyType getKey(const CountedRegion &R) {
57 return uint64_t(R.LineStart) | uint64_t(R.ColumnStart) << 32;
61 void insert(const FunctionCoverageMapping &Function, unsigned FileID) {
63 for (const auto &R : Function.CountedRegions) {
64 if (R.FileID == FileID) {
69 auto I = InstantiatedFunctions.find(Key);
70 if (I == InstantiatedFunctions.end()) {
72 Set.push_back(&Function);
73 InstantiatedFunctions.insert(std::make_pair(Key, Set));
75 I->second.push_back(&Function);
78 std::unordered_map<KeyType, SetType>::iterator begin() {
79 return InstantiatedFunctions.begin();
82 std::unordered_map<KeyType, SetType>::iterator end() {
83 return InstantiatedFunctions.end();
87 /// \brief The implementation of the coverage tool.
88 class CodeCoverageTool {
91 /// \brief The show command.
93 /// \brief The report command.
97 /// \brief Print the error message to the error output stream.
98 void error(const Twine &Message, StringRef Whence = "");
100 /// \brief Return a memory buffer for the given source file.
101 ErrorOr<const MemoryBuffer &> getSourceFile(StringRef SourceFile);
103 /// \brief Return true if two filepaths refer to the same file.
104 bool equivalentFiles(StringRef A, StringRef B);
106 /// \brief Collect a set of function's file ids which correspond to the
107 /// given source file. Return false if the set is empty.
108 bool gatherInterestingFileIDs(StringRef SourceFile,
109 const FunctionCoverageMapping &Function,
110 SmallSet<unsigned, 8> &InterestingFileIDs);
112 /// \brief Find the file id which is not an expanded file id.
113 bool findMainViewFileID(StringRef SourceFile,
114 const FunctionCoverageMapping &Function,
115 unsigned &MainViewFileID);
117 bool findMainViewFileID(const FunctionCoverageMapping &Function,
118 unsigned &MainViewFileID);
120 /// \brief Create a source view which shows coverage for an expansion
122 void createExpansionSubView(const CountedRegion &ExpandedRegion,
123 const FunctionCoverageMapping &Function,
124 SourceCoverageView &Parent);
126 void createExpansionSubViews(SourceCoverageView &View, unsigned ViewFileID,
127 const FunctionCoverageMapping &Function);
129 /// \brief Create a source view which shows coverage for an instantiation
131 void createInstantiationSubView(StringRef SourceFile,
132 const FunctionCoverageMapping &Function,
133 SourceCoverageView &View);
135 /// \brief Create the main source view of a particular source file.
136 /// Return true if this particular source file is not covered.
138 createSourceFileView(StringRef SourceFile, SourceCoverageView &View,
139 ArrayRef<FunctionCoverageMapping> FunctionMappingRecords,
140 bool UseOnlyRegionsInMainFile = false);
142 /// \brief Load the coverage mapping data. Return true if an error occured.
145 int run(Command Cmd, int argc, const char **argv);
147 typedef std::function<int(int, const char **)> CommandLineParserType;
149 int show(int argc, const char **argv,
150 CommandLineParserType commandLineParser);
152 int report(int argc, const char **argv,
153 CommandLineParserType commandLineParser);
155 StringRef ObjectFilename;
156 CoverageViewOptions ViewOpts;
157 std::unique_ptr<IndexedInstrProfReader> PGOReader;
158 CoverageFiltersMatchAll Filters;
159 std::vector<std::string> SourceFiles;
160 std::vector<std::pair<std::string, std::unique_ptr<MemoryBuffer>>>
162 std::vector<FunctionCoverageMapping> FunctionMappingRecords;
163 bool CompareFilenamesOnly;
167 void CodeCoverageTool::error(const Twine &Message, StringRef Whence) {
170 errs() << Whence << ": ";
171 errs() << Message << "\n";
174 ErrorOr<const MemoryBuffer &>
175 CodeCoverageTool::getSourceFile(StringRef SourceFile) {
176 SmallString<256> Path(SourceFile);
177 sys::fs::make_absolute(Path);
178 for (const auto &Files : LoadedSourceFiles) {
179 if (equivalentFiles(Path.str(), Files.first)) {
180 return *Files.second;
183 auto Buffer = MemoryBuffer::getFile(SourceFile);
184 if (auto EC = Buffer.getError()) {
185 error(EC.message(), SourceFile);
188 LoadedSourceFiles.push_back(std::make_pair(
189 std::string(Path.begin(), Path.end()), std::move(Buffer.get())));
190 return *LoadedSourceFiles.back().second;
193 /// \brief Return a line start - line end range which contains
194 /// all the mapping regions of a given function with a particular file id.
195 std::pair<unsigned, unsigned>
196 findExpandedFileInterestingLineRange(unsigned FileID,
197 const FunctionCoverageMapping &Function) {
198 unsigned LineStart = std::numeric_limits<unsigned>::max();
199 unsigned LineEnd = 0;
200 for (const auto &CR : Function.CountedRegions) {
201 if (CR.FileID != FileID)
203 LineStart = std::min(CR.LineStart, LineStart);
204 LineEnd = std::max(CR.LineEnd, LineEnd);
206 return std::make_pair(LineStart, LineEnd);
209 bool CodeCoverageTool::equivalentFiles(StringRef A, StringRef B) {
210 if (CompareFilenamesOnly)
211 return sys::path::filename(A).equals_lower(sys::path::filename(B));
212 return sys::fs::equivalent(A, B);
215 bool CodeCoverageTool::gatherInterestingFileIDs(
216 StringRef SourceFile, const FunctionCoverageMapping &Function,
217 SmallSet<unsigned, 8> &InterestingFileIDs) {
218 bool Interesting = false;
219 for (unsigned I = 0, E = Function.Filenames.size(); I < E; ++I) {
220 if (equivalentFiles(SourceFile, Function.Filenames[I])) {
221 InterestingFileIDs.insert(I);
229 CodeCoverageTool::findMainViewFileID(StringRef SourceFile,
230 const FunctionCoverageMapping &Function,
231 unsigned &MainViewFileID) {
232 llvm::SmallVector<bool, 8> IsExpandedFile(Function.Filenames.size(), false);
233 llvm::SmallVector<bool, 8> FilenameEquivalence(Function.Filenames.size(),
235 for (unsigned I = 0, E = Function.Filenames.size(); I < E; ++I) {
236 if (equivalentFiles(SourceFile, Function.Filenames[I]))
237 FilenameEquivalence[I] = true;
239 for (const auto &CR : Function.CountedRegions) {
240 if (CR.Kind == CounterMappingRegion::ExpansionRegion &&
241 FilenameEquivalence[CR.FileID])
242 IsExpandedFile[CR.ExpandedFileID] = true;
244 for (unsigned I = 0, E = Function.Filenames.size(); I < E; ++I) {
245 if (!FilenameEquivalence[I] || IsExpandedFile[I])
254 CodeCoverageTool::findMainViewFileID(const FunctionCoverageMapping &Function,
255 unsigned &MainViewFileID) {
256 llvm::SmallVector<bool, 8> IsExpandedFile(Function.Filenames.size(), false);
257 for (const auto &CR : Function.CountedRegions) {
258 if (CR.Kind == CounterMappingRegion::ExpansionRegion)
259 IsExpandedFile[CR.ExpandedFileID] = true;
261 for (unsigned I = 0, E = Function.Filenames.size(); I < E; ++I) {
262 if (IsExpandedFile[I])
270 void CodeCoverageTool::createExpansionSubView(
271 const CountedRegion &ExpandedRegion,
272 const FunctionCoverageMapping &Function, SourceCoverageView &Parent) {
273 auto ExpandedLines = findExpandedFileInterestingLineRange(
274 ExpandedRegion.ExpandedFileID, Function);
276 llvm::outs() << "Expansion of " << ExpandedRegion.ExpandedFileID << ":"
277 << ExpandedLines.first << " -> " << ExpandedLines.second
278 << " @ " << ExpandedRegion.FileID << ", "
279 << ExpandedRegion.LineStart << ":"
280 << ExpandedRegion.ColumnStart << "\n";
282 getSourceFile(Function.Filenames[ExpandedRegion.ExpandedFileID]);
285 auto SubView = llvm::make_unique<SourceCoverageView>(
286 SourceBuffer.get(), Parent.getOptions(), ExpandedLines.first,
287 ExpandedLines.second, ExpandedRegion);
288 SourceCoverageDataManager RegionManager;
289 for (const auto &CR : Function.CountedRegions) {
290 if (CR.FileID == ExpandedRegion.ExpandedFileID)
291 RegionManager.insert(CR);
293 SubView->load(RegionManager);
294 createExpansionSubViews(*SubView, ExpandedRegion.ExpandedFileID, Function);
295 Parent.addChild(std::move(SubView));
298 void CodeCoverageTool::createExpansionSubViews(
299 SourceCoverageView &View, unsigned ViewFileID,
300 const FunctionCoverageMapping &Function) {
301 if (!ViewOpts.ShowExpandedRegions)
303 for (const auto &CR : Function.CountedRegions) {
304 if (CR.Kind != CounterMappingRegion::ExpansionRegion)
306 if (CR.FileID != ViewFileID)
308 createExpansionSubView(CR, Function, View);
312 void CodeCoverageTool::createInstantiationSubView(
313 StringRef SourceFile, const FunctionCoverageMapping &Function,
314 SourceCoverageView &View) {
315 SourceCoverageDataManager RegionManager;
316 SmallSet<unsigned, 8> InterestingFileIDs;
317 if (!gatherInterestingFileIDs(SourceFile, Function, InterestingFileIDs))
319 // Get the interesting regions
320 for (const auto &CR : Function.CountedRegions) {
321 if (InterestingFileIDs.count(CR.FileID))
322 RegionManager.insert(CR);
324 View.load(RegionManager);
326 if (findMainViewFileID(SourceFile, Function, MainFileID))
328 createExpansionSubViews(View, MainFileID, Function);
331 bool CodeCoverageTool::createSourceFileView(
332 StringRef SourceFile, SourceCoverageView &View,
333 ArrayRef<FunctionCoverageMapping> FunctionMappingRecords,
334 bool UseOnlyRegionsInMainFile) {
335 SourceCoverageDataManager RegionManager;
336 FunctionInstantiationSetCollector InstantiationSetCollector;
338 for (const auto &Function : FunctionMappingRecords) {
340 if (findMainViewFileID(SourceFile, Function, MainFileID))
342 SmallSet<unsigned, 8> InterestingFileIDs;
343 if (UseOnlyRegionsInMainFile) {
344 InterestingFileIDs.insert(MainFileID);
345 } else if (!gatherInterestingFileIDs(SourceFile, Function,
348 // Get the interesting regions
349 for (const auto &CR : Function.CountedRegions) {
350 if (InterestingFileIDs.count(CR.FileID))
351 RegionManager.insert(CR);
353 InstantiationSetCollector.insert(Function, MainFileID);
354 createExpansionSubViews(View, MainFileID, Function);
356 if (RegionManager.getSourceRegions().empty())
358 View.load(RegionManager);
359 // Show instantiations
360 if (!ViewOpts.ShowFunctionInstantiations)
362 for (const auto &InstantiationSet : InstantiationSetCollector) {
363 if (InstantiationSet.second.size() < 2)
365 auto InterestingRange = findExpandedFileInterestingLineRange(
366 InstantiationSet.second.front()->CountedRegions.front().FileID,
367 *InstantiationSet.second.front());
368 for (auto Function : InstantiationSet.second) {
369 auto SubView = llvm::make_unique<SourceCoverageView>(
370 View, InterestingRange.first, InterestingRange.second,
372 createInstantiationSubView(SourceFile, *Function, *SubView);
373 View.addChild(std::move(SubView));
379 bool CodeCoverageTool::load() {
380 auto CounterMappingBuff = MemoryBuffer::getFileOrSTDIN(ObjectFilename);
381 if (auto EC = CounterMappingBuff.getError()) {
382 error(EC.message(), ObjectFilename);
385 ObjectFileCoverageMappingReader MappingReader(CounterMappingBuff.get());
386 if (auto EC = MappingReader.readHeader()) {
387 error(EC.message(), ObjectFilename);
391 std::vector<uint64_t> Counts;
392 for (const auto &I : MappingReader) {
393 FunctionCoverageMapping Function(I.FunctionName, I.Filenames);
395 // Create the mapping regions with evaluated execution counts
397 PGOReader->getFunctionCounts(Function.Name, I.FunctionHash, Counts);
399 // Get the biggest referenced counters
400 bool RegionError = false;
401 CounterMappingContext Ctx(I.Expressions, Counts);
402 for (const auto &R : I.MappingRegions) {
403 // Compute the values of mapped regions
404 if (ViewOpts.Debug) {
405 outs() << "File " << R.FileID << "| " << R.LineStart << ":"
406 << R.ColumnStart << " -> " << R.LineEnd << ":" << R.ColumnEnd
409 if (R.Kind == CounterMappingRegion::ExpansionRegion) {
410 outs() << " (Expanded file id = " << R.ExpandedFileID << ") ";
414 ErrorOr<int64_t> ExecutionCount = Ctx.evaluate(R.Count);
415 if (ExecutionCount) {
416 Function.CountedRegions.push_back(CountedRegion(R, *ExecutionCount));
417 } else if (!RegionError) {
418 colored_ostream(errs(), raw_ostream::RED)
419 << "error: Regions and counters don't match in a function '"
420 << Function.Name << "' (re-run the instrumented binary).";
426 if (RegionError || !Filters.matches(Function))
429 FunctionMappingRecords.push_back(Function);
434 int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
435 // Print a stack trace if we signal out.
436 sys::PrintStackTraceOnErrorSignal();
437 PrettyStackTraceProgram X(argc, argv);
438 llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
440 cl::list<std::string> InputSourceFiles(
441 cl::Positional, cl::desc("<Source files>"), cl::ZeroOrMore);
443 cl::opt<std::string> PGOFilename(
444 "instr-profile", cl::Required,
446 "File with the profile data obtained after an instrumented run"));
448 cl::opt<bool> DebugDump("dump", cl::Optional,
449 cl::desc("Show internal debug dump"));
451 cl::opt<bool> FilenameEquivalence(
452 "filename-equivalence", cl::Optional,
453 cl::desc("Compare the filenames instead of full filepaths"));
455 cl::OptionCategory FilteringCategory("Function filtering options");
457 cl::list<std::string> NameFilters(
458 "name", cl::Optional,
459 cl::desc("Show code coverage only for functions with the given name"),
460 cl::ZeroOrMore, cl::cat(FilteringCategory));
462 cl::list<std::string> NameRegexFilters(
463 "name-regex", cl::Optional,
464 cl::desc("Show code coverage only for functions that match the given "
465 "regular expression"),
466 cl::ZeroOrMore, cl::cat(FilteringCategory));
468 cl::opt<double> RegionCoverageLtFilter(
469 "region-coverage-lt", cl::Optional,
470 cl::desc("Show code coverage only for functions with region coverage "
471 "less than the given threshold"),
472 cl::cat(FilteringCategory));
474 cl::opt<double> RegionCoverageGtFilter(
475 "region-coverage-gt", cl::Optional,
476 cl::desc("Show code coverage only for functions with region coverage "
477 "greater than the given threshold"),
478 cl::cat(FilteringCategory));
480 cl::opt<double> LineCoverageLtFilter(
481 "line-coverage-lt", cl::Optional,
482 cl::desc("Show code coverage only for functions with line coverage less "
483 "than the given threshold"),
484 cl::cat(FilteringCategory));
486 cl::opt<double> LineCoverageGtFilter(
487 "line-coverage-gt", cl::Optional,
488 cl::desc("Show code coverage only for functions with line coverage "
489 "greater than the given threshold"),
490 cl::cat(FilteringCategory));
492 auto commandLineParser = [&, this](int argc, const char **argv) -> int {
493 cl::ParseCommandLineOptions(argc, argv, "LLVM code coverage tool\n");
494 ViewOpts.Debug = DebugDump;
495 CompareFilenamesOnly = FilenameEquivalence;
497 if (auto EC = IndexedInstrProfReader::create(PGOFilename, PGOReader)) {
498 error(EC.message(), PGOFilename);
502 // Create the function filters
503 if (!NameFilters.empty() || !NameRegexFilters.empty()) {
504 auto NameFilterer = new CoverageFilters;
505 for (const auto &Name : NameFilters)
506 NameFilterer->push_back(llvm::make_unique<NameCoverageFilter>(Name));
507 for (const auto &Regex : NameRegexFilters)
508 NameFilterer->push_back(
509 llvm::make_unique<NameRegexCoverageFilter>(Regex));
510 Filters.push_back(std::unique_ptr<CoverageFilter>(NameFilterer));
512 if (RegionCoverageLtFilter.getNumOccurrences() ||
513 RegionCoverageGtFilter.getNumOccurrences() ||
514 LineCoverageLtFilter.getNumOccurrences() ||
515 LineCoverageGtFilter.getNumOccurrences()) {
516 auto StatFilterer = new CoverageFilters;
517 if (RegionCoverageLtFilter.getNumOccurrences())
518 StatFilterer->push_back(llvm::make_unique<RegionCoverageFilter>(
519 RegionCoverageFilter::LessThan, RegionCoverageLtFilter));
520 if (RegionCoverageGtFilter.getNumOccurrences())
521 StatFilterer->push_back(llvm::make_unique<RegionCoverageFilter>(
522 RegionCoverageFilter::GreaterThan, RegionCoverageGtFilter));
523 if (LineCoverageLtFilter.getNumOccurrences())
524 StatFilterer->push_back(llvm::make_unique<LineCoverageFilter>(
525 LineCoverageFilter::LessThan, LineCoverageLtFilter));
526 if (LineCoverageGtFilter.getNumOccurrences())
527 StatFilterer->push_back(llvm::make_unique<LineCoverageFilter>(
528 RegionCoverageFilter::GreaterThan, LineCoverageGtFilter));
529 Filters.push_back(std::unique_ptr<CoverageFilter>(StatFilterer));
532 SourceFiles = InputSourceFiles;
536 // Parse the object filename
538 StringRef Arg(argv[1]);
539 if (Arg.equals_lower("-help") || Arg.equals_lower("-version")) {
540 cl::ParseCommandLineOptions(2, argv, "LLVM code coverage tool\n");
543 ObjectFilename = Arg;
549 errs() << sys::path::filename(argv[0]) << ": No executable file given!\n";
555 return show(argc, argv, commandLineParser);
557 return report(argc, argv, commandLineParser);
562 int CodeCoverageTool::show(int argc, const char **argv,
563 CommandLineParserType commandLineParser) {
565 cl::OptionCategory ViewCategory("Viewing options");
567 cl::opt<bool> ShowLineExecutionCounts(
568 "show-line-counts", cl::Optional,
569 cl::desc("Show the execution counts for each line"), cl::init(true),
570 cl::cat(ViewCategory));
572 cl::opt<bool> ShowRegions(
573 "show-regions", cl::Optional,
574 cl::desc("Show the execution counts for each region"),
575 cl::cat(ViewCategory));
577 cl::opt<bool> ShowBestLineRegionsCounts(
578 "show-line-counts-or-regions", cl::Optional,
579 cl::desc("Show the execution counts for each line, or the execution "
580 "counts for each region on lines that have multiple regions"),
581 cl::cat(ViewCategory));
583 cl::opt<bool> ShowExpansions("show-expansions", cl::Optional,
584 cl::desc("Show expanded source regions"),
585 cl::cat(ViewCategory));
587 cl::opt<bool> ShowInstantiations("show-instantiations", cl::Optional,
588 cl::desc("Show function instantiations"),
589 cl::cat(ViewCategory));
591 cl::opt<bool> NoColors("no-colors", cl::Optional,
592 cl::desc("Don't show text colors"), cl::init(false),
593 cl::cat(ViewCategory));
595 auto Err = commandLineParser(argc, argv);
599 ViewOpts.Colors = !NoColors;
600 ViewOpts.ShowLineNumbers = true;
601 ViewOpts.ShowLineStats = ShowLineExecutionCounts.getNumOccurrences() != 0 ||
602 !ShowRegions || ShowBestLineRegionsCounts;
603 ViewOpts.ShowRegionMarkers = ShowRegions || ShowBestLineRegionsCounts;
604 ViewOpts.ShowLineStatsOrRegionMarkers = ShowBestLineRegionsCounts;
605 ViewOpts.ShowExpandedRegions = ShowExpansions;
606 ViewOpts.ShowFunctionInstantiations = ShowInstantiations;
611 if (!Filters.empty()) {
613 for (const auto &Function : FunctionMappingRecords) {
615 if (findMainViewFileID(Function, MainFileID))
617 StringRef SourceFile = Function.Filenames[MainFileID];
618 auto SourceBuffer = getSourceFile(SourceFile);
621 auto Range = findExpandedFileInterestingLineRange(MainFileID, Function);
622 SourceCoverageView mainView(SourceBuffer.get(), ViewOpts, Range.first,
624 createSourceFileView(SourceFile, mainView, Function, true);
625 ViewOpts.colored_ostream(outs(), raw_ostream::CYAN)
626 << Function.Name << " from " << SourceFile << ":";
628 mainView.render(outs());
629 if (FunctionMappingRecords.size() > 1)
636 bool ShowFilenames = SourceFiles.size() != 1;
638 if (SourceFiles.empty()) {
639 // Get the source files from the function coverage mapping
640 std::set<StringRef> UniqueFilenames;
641 for (const auto &Function : FunctionMappingRecords) {
642 for (const auto &Filename : Function.Filenames)
643 UniqueFilenames.insert(Filename);
645 for (const auto &Filename : UniqueFilenames)
646 SourceFiles.push_back(Filename);
649 for (const auto &SourceFile : SourceFiles) {
650 auto SourceBuffer = getSourceFile(SourceFile);
653 SourceCoverageView mainView(SourceBuffer.get(), ViewOpts);
654 if (createSourceFileView(SourceFile, mainView, FunctionMappingRecords)) {
655 ViewOpts.colored_ostream(outs(), raw_ostream::RED)
656 << "warning: The file '" << SourceFile << "' isn't covered.";
662 ViewOpts.colored_ostream(outs(), raw_ostream::CYAN) << SourceFile << ":";
665 mainView.render(outs());
666 if (SourceFiles.size() > 1)
673 int CodeCoverageTool::report(int argc, const char **argv,
674 CommandLineParserType commandLineParser) {
675 cl::opt<bool> NoColors("no-colors", cl::Optional,
676 cl::desc("Don't show text colors"), cl::init(false));
678 auto Err = commandLineParser(argc, argv);
682 ViewOpts.Colors = !NoColors;
687 CoverageSummary Summarizer;
688 Summarizer.createSummaries(FunctionMappingRecords);
689 CoverageReport Report(ViewOpts, Summarizer);
690 if (SourceFiles.empty() && Filters.empty()) {
691 Report.renderFileReports(llvm::outs());
695 Report.renderFunctionReports(llvm::outs());
699 int show_main(int argc, const char **argv) {
700 CodeCoverageTool Tool;
701 return Tool.run(CodeCoverageTool::Show, argc, argv);
704 int report_main(int argc, const char **argv) {
705 CodeCoverageTool Tool;
706 return Tool.run(CodeCoverageTool::Report, argc, argv);