CoverageViewOptions.h 2.0 KB

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