1 //===- CoverageExporter.h - Code coverage exporter ------------------------===//
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 defines a code coverage exporter interface.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_COV_COVERAGEEXPORTER_H
15 #define LLVM_COV_COVERAGEEXPORTER_H
16 
17 #include "CoverageFilters.h"
18 #include "CoverageSummaryInfo.h"
19 #include "CoverageViewOptions.h"
20 #include "llvm/ProfileData/Coverage/CoverageMapping.h"
21 
22 namespace llvm {
23 
24 /// Exports the code coverage information.
25 class CoverageExporter {
26 protected:
27   /// The full CoverageMapping object to export.
28   const coverage::CoverageMapping &Coverage;
29 
30   /// The options passed to the tool.
31   const CoverageViewOptions &Options;
32 
33   /// Output stream to print JSON to.
34   raw_ostream &OS;
35 
CoverageExporter(const coverage::CoverageMapping & CoverageMapping,const CoverageViewOptions & Options,raw_ostream & OS)36   CoverageExporter(const coverage::CoverageMapping &CoverageMapping,
37                    const CoverageViewOptions &Options, raw_ostream &OS)
38       : Coverage(CoverageMapping), Options(Options), OS(OS) {}
39 
40 public:
~CoverageExporter()41   virtual ~CoverageExporter(){};
42 
43   /// Render the CoverageMapping object.
44   virtual void renderRoot(const CoverageFilters &IgnoreFilenameFilters) = 0;
45 
46   /// Render the CoverageMapping object for specified source files.
47   virtual void renderRoot(const std::vector<std::string> &SourceFiles) = 0;
48 };
49 
50 } // end namespace llvm
51 
52 #endif // LLVM_COV_COVERAGEEXPORTER_H
53