blob: dde0c692ab054f9034fabcc3182b8aa4b62fe7f2 [file] [log] [blame]
Alex Lorenze82d89c2014-08-22 22:56:03 +00001//===- CoverageViewOptions.h - Code coverage display options -------------===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Alex Lorenze82d89c2014-08-22 22:56:03 +00006//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_COV_COVERAGEVIEWOPTIONS_H
10#define LLVM_COV_COVERAGEVIEWOPTIONS_H
11
Nico Webera48924c2018-04-25 18:34:00 +000012#include "llvm/Config/llvm-config.h"
Alex Lorenze82d89c2014-08-22 22:56:03 +000013#include "RenderingSupport.h"
Vedant Kumar424f51b2016-07-15 22:44:57 +000014#include <vector>
Alex Lorenze82d89c2014-08-22 22:56:03 +000015
16namespace llvm {
17
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000018/// The options for displaying the code coverage information.
Alex Lorenze82d89c2014-08-22 22:56:03 +000019struct CoverageViewOptions {
Vedant Kumar635c83c2016-06-28 00:15:54 +000020 enum class OutputFormat {
Vedant Kumar4c010922016-07-06 21:44:05 +000021 Text,
Max Morozb2091c92018-11-09 16:10:44 +000022 HTML,
23 Lcov
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;
Max Moroza80d9ce2019-03-14 17:49:27 +000037 bool SkipExpansions;
38 bool SkipFunctions;
Vedant Kumarebe84012016-06-28 16:12:15 +000039 OutputFormat Format;
Vedant Kumar7937ef32016-06-28 02:09:39 +000040 std::string ShowOutputDirectory;
Vedant Kumar424f51b2016-07-15 22:44:57 +000041 std::vector<std::string> DemanglerOpts;
Ying Yi0ef31b72016-08-04 10:39:43 +000042 uint32_t TabSize;
Ying Yi84dc9712016-08-24 14:27:23 +000043 std::string ProjectTitle;
Ying Yi84dc9712016-08-24 14:27:23 +000044 std::string CreatedTimeStr;
Max Morozcc254ba2018-01-05 16:15:07 +000045 unsigned NumThreads;
Alex Lorenze82d89c2014-08-22 22:56:03 +000046
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000047 /// Change the output's stream color if the colors are enabled.
Alex Lorenze82d89c2014-08-22 22:56:03 +000048 ColoredRawOstream colored_ostream(raw_ostream &OS,
Rui Ueyama4d41c332019-08-02 07:22:34 +000049 raw_ostream::Colors Color) const {
Alex Lorenze82d89c2014-08-22 22:56:03 +000050 return llvm::colored_ostream(OS, Color, Colors);
51 }
Vedant Kumarde717e62016-06-28 16:12:12 +000052
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000053 /// Check if an output directory has been specified.
Vedant Kumar6ab6b362016-07-15 22:44:54 +000054 bool hasOutputDirectory() const { return !ShowOutputDirectory.empty(); }
Vedant Kumar424f51b2016-07-15 22:44:57 +000055
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000056 /// Check if a demangler has been specified.
Vedant Kumar424f51b2016-07-15 22:44:57 +000057 bool hasDemangler() const { return !DemanglerOpts.empty(); }
Ying Yi84dc9712016-08-24 14:27:23 +000058
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000059 /// Check if a project title has been specified.
Ying Yi84dc9712016-08-24 14:27:23 +000060 bool hasProjectTitle() const { return !ProjectTitle.empty(); }
61
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000062 /// Check if the created time of the profile data file is available.
Ying Yi84dc9712016-08-24 14:27:23 +000063 bool hasCreatedTime() const { return !CreatedTimeStr.empty(); }
Ying Yi544b1df2016-09-13 11:28:31 +000064
Adrian Prantl5f8f34e42018-05-01 15:54:18 +000065 /// Get the LLVM version string.
Ying Yi544b1df2016-09-13 11:28:31 +000066 std::string getLLVMVersionString() const {
67 std::string VersionString = "Generated by llvm-cov -- llvm version ";
68 VersionString += LLVM_VERSION_STRING;
69 return VersionString;
70 }
Alex Lorenze82d89c2014-08-22 22:56:03 +000071};
72}
73
74#endif // LLVM_COV_COVERAGEVIEWOPTIONS_H