blob: fbd230299a2f9996fed2abf22322b17dadb46aee [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
Nico Webera48924c2018-04-25 18:34:00 +000013#include "llvm/Config/llvm-config.h"
Alex Lorenze82d89c2014-08-22 22:56:03 +000014#include "RenderingSupport.h"
Vedant Kumar424f51b2016-07-15 22:44:57 +000015#include <vector>
Alex Lorenze82d89c2014-08-22 22:56:03 +000016
17namespace llvm {
18
19/// \brief The options for displaying the code coverage information.
20struct CoverageViewOptions {
Vedant Kumar635c83c2016-06-28 00:15:54 +000021 enum class OutputFormat {
Vedant Kumar4c010922016-07-06 21:44:05 +000022 Text,
23 HTML
Vedant Kumar635c83c2016-06-28 00:15:54 +000024 };
25
Alex Lorenze82d89c2014-08-22 22:56:03 +000026 bool Debug;
27 bool Colors;
28 bool ShowLineNumbers;
29 bool ShowLineStats;
30 bool ShowRegionMarkers;
Alex Lorenze82d89c2014-08-22 22:56:03 +000031 bool ShowExpandedRegions;
32 bool ShowFunctionInstantiations;
Vedant Kumarc3c39e72015-09-14 23:26:36 +000033 bool ShowFullFilenames;
Eli Friedman50479f62017-09-11 22:56:20 +000034 bool ShowRegionSummary;
35 bool ShowInstantiationSummary;
Max Morozfe4d9042017-12-11 23:17:46 +000036 bool ExportSummaryOnly;
Vedant Kumarebe84012016-06-28 16:12:15 +000037 OutputFormat Format;
Vedant Kumar7937ef32016-06-28 02:09:39 +000038 std::string ShowOutputDirectory;
Vedant Kumar424f51b2016-07-15 22:44:57 +000039 std::vector<std::string> DemanglerOpts;
Ying Yi0ef31b72016-08-04 10:39:43 +000040 uint32_t TabSize;
Ying Yi84dc9712016-08-24 14:27:23 +000041 std::string ProjectTitle;
Ying Yi84dc9712016-08-24 14:27:23 +000042 std::string CreatedTimeStr;
Max Morozcc254ba2018-01-05 16:15:07 +000043 unsigned NumThreads;
Alex Lorenze82d89c2014-08-22 22:56:03 +000044
45 /// \brief Change the output's stream color if the colors are enabled.
46 ColoredRawOstream colored_ostream(raw_ostream &OS,
47 raw_ostream::Colors Color) const {
48 return llvm::colored_ostream(OS, Color, Colors);
49 }
Vedant Kumarde717e62016-06-28 16:12:12 +000050
51 /// \brief Check if an output directory has been specified.
Vedant Kumar6ab6b362016-07-15 22:44:54 +000052 bool hasOutputDirectory() const { return !ShowOutputDirectory.empty(); }
Vedant Kumar424f51b2016-07-15 22:44:57 +000053
54 /// \brief Check if a demangler has been specified.
55 bool hasDemangler() const { return !DemanglerOpts.empty(); }
Ying Yi84dc9712016-08-24 14:27:23 +000056
57 /// \brief Check if a project title has been specified.
58 bool hasProjectTitle() const { return !ProjectTitle.empty(); }
59
60 /// \brief Check if the created time of the profile data file is available.
61 bool hasCreatedTime() const { return !CreatedTimeStr.empty(); }
Ying Yi544b1df2016-09-13 11:28:31 +000062
63 /// \brief Get the LLVM version string.
64 std::string getLLVMVersionString() const {
65 std::string VersionString = "Generated by llvm-cov -- llvm version ";
66 VersionString += LLVM_VERSION_STRING;
67 return VersionString;
68 }
Alex Lorenze82d89c2014-08-22 22:56:03 +000069};
70}
71
72#endif // LLVM_COV_COVERAGEVIEWOPTIONS_H