blob: c8a47286002794aa509582031c2fdc1e1708b937 [file] [log] [blame]
Alex Lorenz6c7a6a12014-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 Weber2bcb3332018-04-25 18:34:00 +000013#include "llvm/Config/llvm-config.h"
Alex Lorenz6c7a6a12014-08-22 22:56:03 +000014#include "RenderingSupport.h"
Vedant Kumar13ca1cc2016-07-15 22:44:57 +000015#include <vector>
Alex Lorenz6c7a6a12014-08-22 22:56:03 +000016
17namespace llvm {
18
Adrian Prantl26b584c2018-05-01 15:54:18 +000019/// The options for displaying the code coverage information.
Alex Lorenz6c7a6a12014-08-22 22:56:03 +000020struct CoverageViewOptions {
Vedant Kumar0347ce72016-06-28 00:15:54 +000021 enum class OutputFormat {
Vedant Kumar55c8c002016-07-06 21:44:05 +000022 Text,
Max Morozfcdc2672018-11-09 16:10:44 +000023 HTML,
24 Lcov
Vedant Kumar0347ce72016-06-28 00:15:54 +000025 };
26
Alex Lorenz6c7a6a12014-08-22 22:56:03 +000027 bool Debug;
28 bool Colors;
29 bool ShowLineNumbers;
30 bool ShowLineStats;
31 bool ShowRegionMarkers;
Alex Lorenz6c7a6a12014-08-22 22:56:03 +000032 bool ShowExpandedRegions;
33 bool ShowFunctionInstantiations;
Vedant Kumar97c9f0c2015-09-14 23:26:36 +000034 bool ShowFullFilenames;
Eli Friedmand3822e42017-09-11 22:56:20 +000035 bool ShowRegionSummary;
36 bool ShowInstantiationSummary;
Max Morozd4b0ab02017-12-11 23:17:46 +000037 bool ExportSummaryOnly;
Vedant Kumarc5fab6a2016-06-28 16:12:15 +000038 OutputFormat Format;
Vedant Kumar40a78f82016-06-28 02:09:39 +000039 std::string ShowOutputDirectory;
Vedant Kumar13ca1cc2016-07-15 22:44:57 +000040 std::vector<std::string> DemanglerOpts;
Ying Yi65787e22016-08-04 10:39:43 +000041 uint32_t TabSize;
Ying Yi1461e992016-08-24 14:27:23 +000042 std::string ProjectTitle;
Ying Yi1461e992016-08-24 14:27:23 +000043 std::string CreatedTimeStr;
Max Morozd6352ca2018-01-05 16:15:07 +000044 unsigned NumThreads;
Alex Lorenz6c7a6a12014-08-22 22:56:03 +000045
Adrian Prantl26b584c2018-05-01 15:54:18 +000046 /// Change the output's stream color if the colors are enabled.
Alex Lorenz6c7a6a12014-08-22 22:56:03 +000047 ColoredRawOstream colored_ostream(raw_ostream &OS,
48 raw_ostream::Colors Color) const {
49 return llvm::colored_ostream(OS, Color, Colors);
50 }
Vedant Kumare0173722016-06-28 16:12:12 +000051
Adrian Prantl26b584c2018-05-01 15:54:18 +000052 /// Check if an output directory has been specified.
Vedant Kumara5ec41d2016-07-15 22:44:54 +000053 bool hasOutputDirectory() const { return !ShowOutputDirectory.empty(); }
Vedant Kumar13ca1cc2016-07-15 22:44:57 +000054
Adrian Prantl26b584c2018-05-01 15:54:18 +000055 /// Check if a demangler has been specified.
Vedant Kumar13ca1cc2016-07-15 22:44:57 +000056 bool hasDemangler() const { return !DemanglerOpts.empty(); }
Ying Yi1461e992016-08-24 14:27:23 +000057
Adrian Prantl26b584c2018-05-01 15:54:18 +000058 /// Check if a project title has been specified.
Ying Yi1461e992016-08-24 14:27:23 +000059 bool hasProjectTitle() const { return !ProjectTitle.empty(); }
60
Adrian Prantl26b584c2018-05-01 15:54:18 +000061 /// Check if the created time of the profile data file is available.
Ying Yi1461e992016-08-24 14:27:23 +000062 bool hasCreatedTime() const { return !CreatedTimeStr.empty(); }
Ying Yi503f4622016-09-13 11:28:31 +000063
Adrian Prantl26b584c2018-05-01 15:54:18 +000064 /// Get the LLVM version string.
Ying Yi503f4622016-09-13 11:28:31 +000065 std::string getLLVMVersionString() const {
66 std::string VersionString = "Generated by llvm-cov -- llvm version ";
67 VersionString += LLVM_VERSION_STRING;
68 return VersionString;
69 }
Alex Lorenz6c7a6a12014-08-22 22:56:03 +000070};
71}
72
73#endif // LLVM_COV_COVERAGEVIEWOPTIONS_H