CoverageViewOptions.h revision 314564
10SN/A//===- CoverageViewOptions.h - Code coverage display options -------------===//
27311SN/A//
30SN/A//                     The LLVM Compiler Infrastructure
40SN/A//
50SN/A// This file is distributed under the University of Illinois Open Source
60SN/A// License. See LICENSE.TXT for details.
72362SN/A//
80SN/A//===----------------------------------------------------------------------===//
92362SN/A
100SN/A#ifndef LLVM_COV_COVERAGEVIEWOPTIONS_H
110SN/A#define LLVM_COV_COVERAGEVIEWOPTIONS_H
120SN/A
130SN/A#include "RenderingSupport.h"
140SN/A#include <vector>
150SN/A
160SN/Anamespace llvm {
170SN/A
180SN/A/// \brief The options for displaying the code coverage information.
190SN/Astruct CoverageViewOptions {
200SN/A  enum class OutputFormat {
212362SN/A    Text,
222362SN/A    HTML
232362SN/A  };
240SN/A
250SN/A  bool Debug;
260SN/A  bool Colors;
270SN/A  bool ShowLineNumbers;
280SN/A  bool ShowLineStats;
290SN/A  bool ShowRegionMarkers;
300SN/A  bool ShowLineStatsOrRegionMarkers;
310SN/A  bool ShowExpandedRegions;
320SN/A  bool ShowFunctionInstantiations;
330SN/A  bool ShowFullFilenames;
340SN/A  OutputFormat Format;
350SN/A  std::string ShowOutputDirectory;
360SN/A  std::vector<std::string> DemanglerOpts;
370SN/A  uint32_t TabSize;
380SN/A  std::string ProjectTitle;
390SN/A  std::string CreatedTimeStr;
400SN/A
410SN/A  /// \brief Change the output's stream color if the colors are enabled.
420SN/A  ColoredRawOstream colored_ostream(raw_ostream &OS,
430SN/A                                    raw_ostream::Colors Color) const {
440SN/A    return llvm::colored_ostream(OS, Color, Colors);
450SN/A  }
463412SN/A
473412SN/A  /// \brief Check if an output directory has been specified.
484235SN/A  bool hasOutputDirectory() const { return !ShowOutputDirectory.empty(); }
497311SN/A
500SN/A  /// \brief Check if a demangler has been specified.
510SN/A  bool hasDemangler() const { return !DemanglerOpts.empty(); }
520SN/A
530SN/A  /// \brief Check if a project title has been specified.
540SN/A  bool hasProjectTitle() const { return !ProjectTitle.empty(); }
550SN/A
560SN/A  /// \brief Check if the created time of the profile data file is available.
570SN/A  bool hasCreatedTime() const { return !CreatedTimeStr.empty(); }
580SN/A
590SN/A  /// \brief Get the LLVM version string.
600SN/A  std::string getLLVMVersionString() const {
610SN/A    std::string VersionString = "Generated by llvm-cov -- llvm version ";
620SN/A    VersionString += LLVM_VERSION_STRING;
630SN/A    return VersionString;
640SN/A  }
650SN/A};
660SN/A}
670SN/A
680SN/A#endif // LLVM_COV_COVERAGEVIEWOPTIONS_H
690SN/A