blob: 20085a957bb5b61f481e33cdeeecb2e328716dbf [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
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000019/// The options for displaying the code coverage information.
Alex Lorenze82d89c2014-08-22 22:56:03 +000020struct 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
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000045 /// Change the output's stream color if the colors are enabled.
Alex Lorenze82d89c2014-08-22 22:56:03 +000046 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
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000051 /// 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
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000054 /// Check if a demangler has been specified.
Vedant Kumar424f51b2016-07-15 22:44:57 +000055 bool hasDemangler() const { return !DemanglerOpts.empty(); }
Ying Yi84dc9712016-08-24 14:27:23 +000056
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000057 /// Check if a project title has been specified.
Ying Yi84dc9712016-08-24 14:27:23 +000058 bool hasProjectTitle() const { return !ProjectTitle.empty(); }
59
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000060 /// Check if the created time of the profile data file is available.
Ying Yi84dc9712016-08-24 14:27:23 +000061 bool hasCreatedTime() const { return !CreatedTimeStr.empty(); }
Ying Yi544b1df2016-09-13 11:28:31 +000062
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000063 /// Get the LLVM version string.
Ying Yi544b1df2016-09-13 11:28:31 +000064 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