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