blob: 17614c4e9ba206cae6f8c3f455881e7a372fefea [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;
Alex Lorenze82d89c2014-08-22 22:56:03 +000030 bool ShowExpandedRegions;
31 bool ShowFunctionInstantiations;
Vedant Kumarc3c39e72015-09-14 23:26:36 +000032 bool ShowFullFilenames;
Eli Friedman50479f62017-09-11 22:56:20 +000033 bool ShowRegionSummary;
34 bool ShowInstantiationSummary;
Max Morozfe4d9042017-12-11 23:17:46 +000035 bool ExportSummaryOnly;
Vedant Kumarebe84012016-06-28 16:12:15 +000036 OutputFormat Format;
Vedant Kumar7937ef32016-06-28 02:09:39 +000037 std::string ShowOutputDirectory;
Vedant Kumar424f51b2016-07-15 22:44:57 +000038 std::vector<std::string> DemanglerOpts;
Ying Yi0ef31b72016-08-04 10:39:43 +000039 uint32_t TabSize;
Ying Yi84dc9712016-08-24 14:27:23 +000040 std::string ProjectTitle;
Ying Yi84dc9712016-08-24 14:27:23 +000041 std::string CreatedTimeStr;
Alex Lorenze82d89c2014-08-22 22:56:03 +000042
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 }
Vedant Kumarde717e62016-06-28 16:12:12 +000048
49 /// \brief Check if an output directory has been specified.
Vedant Kumar6ab6b362016-07-15 22:44:54 +000050 bool hasOutputDirectory() const { return !ShowOutputDirectory.empty(); }
Vedant Kumar424f51b2016-07-15 22:44:57 +000051
52 /// \brief Check if a demangler has been specified.
53 bool hasDemangler() const { return !DemanglerOpts.empty(); }
Ying Yi84dc9712016-08-24 14:27:23 +000054
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(); }
Ying Yi544b1df2016-09-13 11:28:31 +000060
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 }
Alex Lorenze82d89c2014-08-22 22:56:03 +000067};
68}
69
70#endif // LLVM_COV_COVERAGEVIEWOPTIONS_H