CoverageExporter.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. #ifndef LLVM_COV_COVERAGEEXPORTER_H
  13. #define LLVM_COV_COVERAGEEXPORTER_H
  14. #include "CoverageFilters.h"
  15. #include "CoverageSummaryInfo.h"
  16. #include "CoverageViewOptions.h"
  17. #include "llvm/ProfileData/Coverage/CoverageMapping.h"
  18. namespace llvm {
  19. /// Exports the code coverage information.
  20. class CoverageExporter {
  21. protected:
  22. /// The full CoverageMapping object to export.
  23. const coverage::CoverageMapping &Coverage;
  24. /// The options passed to the tool.
  25. const CoverageViewOptions &Options;
  26. /// Output stream to print to.
  27. raw_ostream &OS;
  28. CoverageExporter(const coverage::CoverageMapping &CoverageMapping,
  29. const CoverageViewOptions &Options, raw_ostream &OS)
  30. : Coverage(CoverageMapping), Options(Options), OS(OS) {}
  31. public:
  32. virtual ~CoverageExporter(){};
  33. /// Render the CoverageMapping object.
  34. virtual void renderRoot(const CoverageFilters &IgnoreFilters) = 0;
  35. /// Render the CoverageMapping object for specified source files.
  36. virtual void renderRoot(ArrayRef<std::string> SourceFiles) = 0;
  37. };
  38. } // end namespace llvm
  39. #endif // LLVM_COV_COVERAGEEXPORTER_H