CoverageViewOptions.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. //===- CoverageViewOptions.h - Code coverage display options -------------===//
  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. #ifndef LLVM_COV_COVERAGEVIEWOPTIONS_H
  9. #define LLVM_COV_COVERAGEVIEWOPTIONS_H
  10. #include "llvm/Config/llvm-config.h"
  11. #include "RenderingSupport.h"
  12. #include <vector>
  13. namespace llvm {
  14. /// The options for displaying the code coverage information.
  15. struct CoverageViewOptions {
  16. enum class OutputFormat {
  17. Text,
  18. HTML,
  19. Lcov
  20. };
  21. enum class BranchOutputType { Count, Percent, Off };
  22. bool Debug;
  23. bool Colors;
  24. bool ShowLineNumbers;
  25. bool ShowLineStats;
  26. bool ShowRegionMarkers;
  27. bool ShowBranchCounts;
  28. bool ShowBranchPercents;
  29. bool ShowExpandedRegions;
  30. bool ShowFunctionInstantiations;
  31. bool ShowFullFilenames;
  32. bool ShowBranchSummary;
  33. bool ShowRegionSummary;
  34. bool ShowInstantiationSummary;
  35. bool ExportSummaryOnly;
  36. bool SkipExpansions;
  37. bool SkipFunctions;
  38. OutputFormat Format;
  39. BranchOutputType ShowBranches;
  40. std::string ShowOutputDirectory;
  41. std::vector<std::string> DemanglerOpts;
  42. uint32_t TabSize;
  43. std::string ProjectTitle;
  44. std::string CreatedTimeStr;
  45. unsigned NumThreads;
  46. std::string CompilationDirectory;
  47. /// Change the output's stream color if the colors are enabled.
  48. ColoredRawOstream colored_ostream(raw_ostream &OS,
  49. raw_ostream::Colors Color) const {
  50. return llvm::colored_ostream(OS, Color, Colors);
  51. }
  52. /// Check if an output directory has been specified.
  53. bool hasOutputDirectory() const { return !ShowOutputDirectory.empty(); }
  54. /// Check if a demangler has been specified.
  55. bool hasDemangler() const { return !DemanglerOpts.empty(); }
  56. /// Check if a project title has been specified.
  57. bool hasProjectTitle() const { return !ProjectTitle.empty(); }
  58. /// Check if the created time of the profile data file is available.
  59. bool hasCreatedTime() const { return !CreatedTimeStr.empty(); }
  60. /// Get the LLVM version string.
  61. std::string getLLVMVersionString() const {
  62. std::string VersionString = "Generated by llvm-cov -- llvm version ";
  63. VersionString += LLVM_VERSION_STRING;
  64. return VersionString;
  65. }
  66. };
  67. }
  68. #endif // LLVM_COV_COVERAGEVIEWOPTIONS_H