| 1 | //===- CoverageExporter.h - Code coverage exporter ------------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // This class defines a code coverage exporter interface. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #ifndef LLVM_COV_COVERAGEEXPORTER_H |
| 14 | #define LLVM_COV_COVERAGEEXPORTER_H |
| 15 | |
| 16 | #include "CoverageFilters.h" |
| 17 | #include "CoverageSummaryInfo.h" |
| 18 | #include "CoverageViewOptions.h" |
| 19 | #include "llvm/ProfileData/Coverage/CoverageMapping.h" |
| 20 | |
| 21 | namespace llvm { |
| 22 | |
| 23 | /// Exports the code coverage information. |
| 24 | class CoverageExporter { |
| 25 | protected: |
| 26 | /// The full CoverageMapping object to export. |
| 27 | const coverage::CoverageMapping &Coverage; |
| 28 | |
| 29 | /// The options passed to the tool. |
| 30 | const CoverageViewOptions &Options; |
| 31 | |
| 32 | /// Output stream to print to. |
| 33 | raw_ostream &OS; |
| 34 | |
| 35 | CoverageExporter(const coverage::CoverageMapping &CoverageMapping, |
| 36 | const CoverageViewOptions &Options, raw_ostream &OS) |
| 37 | : Coverage(CoverageMapping), Options(Options), OS(OS) {} |
| 38 | |
| 39 | public: |
| 40 | virtual ~CoverageExporter(){}; |
| 41 | |
| 42 | /// Render the CoverageMapping object. |
| 43 | virtual void renderRoot(const CoverageFilters &IgnoreFilters) = 0; |
| 44 | |
| 45 | /// Render the CoverageMapping object for specified source files. |
| 46 | virtual void renderRoot(ArrayRef<std::string> SourceFiles) = 0; |
| 47 | }; |
| 48 | |
| 49 | } // end namespace llvm |
| 50 | |
| 51 | #endif // LLVM_COV_COVERAGEEXPORTER_H |
| 52 | |