xref: /minix3/external/bsd/llvm/dist/llvm/tools/llvm-cov/CoverageSummary.h (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1 //===- CoverageSummary.h - Code coverage summary --------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This class implements data management and rendering for the code coverage
11 // summaries of all files and functions.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_COV_COVERAGESUMMARY_H
16 #define LLVM_COV_COVERAGESUMMARY_H
17 
18 #include "CoverageSummaryInfo.h"
19 #include <vector>
20 
21 namespace llvm {
22 
23 /// \brief Manager for the function and file code coverage summaries.
24 class CoverageSummary {
25   std::vector<StringRef> Filenames;
26   std::vector<FunctionCoverageSummary> FunctionSummaries;
27   std::vector<std::pair<unsigned, unsigned>> FunctionSummariesFileIDs;
28   std::vector<FileCoverageSummary> FileSummaries;
29 
30   unsigned getFileID(StringRef Filename);
31 
32 public:
33   void createSummaries(const coverage::CoverageMapping &Coverage);
34 
getFileSummaries()35   ArrayRef<FileCoverageSummary> getFileSummaries() { return FileSummaries; }
36 
37   FileCoverageSummary getCombinedFileSummaries();
38 
39   void render(const FunctionCoverageSummary &Summary, raw_ostream &OS);
40 
41   void render(raw_ostream &OS);
42 };
43 }
44 
45 #endif // LLVM_COV_COVERAGESUMMARY_H
46