blob: 266b380b7d39e93b5e36dd58d328b587548ba350 [file] [log] [blame]
Alex Lorenze82d89c2014-08-22 22:56:03 +00001//===- 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"
Vedant Kumar424f51b2016-07-15 22:44:57 +000014#include <vector>
Alex Lorenze82d89c2014-08-22 22:56:03 +000015
16namespace llvm {
17
18/// \brief The options for displaying the code coverage information.
19struct CoverageViewOptions {
Vedant Kumar635c83c2016-06-28 00:15:54 +000020 enum class OutputFormat {
Vedant Kumar4c010922016-07-06 21:44:05 +000021 Text,
22 HTML
Vedant Kumar635c83c2016-06-28 00:15:54 +000023 };
24
Alex Lorenze82d89c2014-08-22 22:56:03 +000025 bool Debug;
26 bool Colors;
27 bool ShowLineNumbers;
28 bool ShowLineStats;
29 bool ShowRegionMarkers;
30 bool ShowLineStatsOrRegionMarkers;
31 bool ShowExpandedRegions;
32 bool ShowFunctionInstantiations;
Vedant Kumarc3c39e72015-09-14 23:26:36 +000033 bool ShowFullFilenames;
Vedant Kumarebe84012016-06-28 16:12:15 +000034 OutputFormat Format;
Vedant Kumar7937ef32016-06-28 02:09:39 +000035 std::string ShowOutputDirectory;
Vedant Kumar424f51b2016-07-15 22:44:57 +000036 std::vector<std::string> DemanglerOpts;
Ying Yi0ef31b72016-08-04 10:39:43 +000037 uint32_t TabSize;
Ying Yi84dc9712016-08-24 14:27:23 +000038 std::string ProjectTitle;
Ying Yi84dc9712016-08-24 14:27:23 +000039 std::string CreatedTimeStr;
Alex Lorenze82d89c2014-08-22 22:56:03 +000040
41 /// \brief Change the output's stream color if the colors are enabled.
42 ColoredRawOstream colored_ostream(raw_ostream &OS,
43 raw_ostream::Colors Color) const {
44 return llvm::colored_ostream(OS, Color, Colors);
45 }
Vedant Kumarde717e62016-06-28 16:12:12 +000046
47 /// \brief Check if an output directory has been specified.
Vedant Kumar6ab6b362016-07-15 22:44:54 +000048 bool hasOutputDirectory() const { return !ShowOutputDirectory.empty(); }
Vedant Kumar424f51b2016-07-15 22:44:57 +000049
50 /// \brief Check if a demangler has been specified.
51 bool hasDemangler() const { return !DemanglerOpts.empty(); }
Ying Yi84dc9712016-08-24 14:27:23 +000052
53 /// \brief Check if a project title has been specified.
54 bool hasProjectTitle() const { return !ProjectTitle.empty(); }
55
56 /// \brief Check if the created time of the profile data file is available.
57 bool hasCreatedTime() const { return !CreatedTimeStr.empty(); }
Ying Yi544b1df2016-09-13 11:28:31 +000058
59 /// \brief Get the LLVM version string.
60 std::string getLLVMVersionString() const {
61 std::string VersionString = "Generated by llvm-cov -- llvm version ";
62 VersionString += LLVM_VERSION_STRING;
63 return VersionString;
64 }
Alex Lorenze82d89c2014-08-22 22:56:03 +000065};
66}
67
68#endif // LLVM_COV_COVERAGEVIEWOPTIONS_H