Alex Lorenz | e82d89c | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 1 | //===- CoverageViewOptions.h - Code coverage display options -------------===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 3 | // 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 Lorenz | e82d89c | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #ifndef LLVM_COV_COVERAGEVIEWOPTIONS_H |
| 10 | #define LLVM_COV_COVERAGEVIEWOPTIONS_H |
| 11 | |
Nico Weber | a48924c | 2018-04-25 18:34:00 +0000 | [diff] [blame] | 12 | #include "llvm/Config/llvm-config.h" |
Alex Lorenz | e82d89c | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 13 | #include "RenderingSupport.h" |
Vedant Kumar | 424f51b | 2016-07-15 22:44:57 +0000 | [diff] [blame] | 14 | #include <vector> |
Alex Lorenz | e82d89c | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 15 | |
| 16 | namespace llvm { |
| 17 | |
Adrian Prantl | 5f8f34e4 | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 18 | /// The options for displaying the code coverage information. |
Alex Lorenz | e82d89c | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 19 | struct CoverageViewOptions { |
Vedant Kumar | 635c83c | 2016-06-28 00:15:54 +0000 | [diff] [blame] | 20 | enum class OutputFormat { |
Vedant Kumar | 4c01092 | 2016-07-06 21:44:05 +0000 | [diff] [blame] | 21 | Text, |
Max Moroz | b2091c9 | 2018-11-09 16:10:44 +0000 | [diff] [blame] | 22 | HTML, |
| 23 | Lcov |
Vedant Kumar | 635c83c | 2016-06-28 00:15:54 +0000 | [diff] [blame] | 24 | }; |
| 25 | |
Alex Lorenz | e82d89c | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 26 | bool Debug; |
| 27 | bool Colors; |
| 28 | bool ShowLineNumbers; |
| 29 | bool ShowLineStats; |
| 30 | bool ShowRegionMarkers; |
Alex Lorenz | e82d89c | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 31 | bool ShowExpandedRegions; |
| 32 | bool ShowFunctionInstantiations; |
Vedant Kumar | c3c39e7 | 2015-09-14 23:26:36 +0000 | [diff] [blame] | 33 | bool ShowFullFilenames; |
Eli Friedman | 50479f6 | 2017-09-11 22:56:20 +0000 | [diff] [blame] | 34 | bool ShowRegionSummary; |
| 35 | bool ShowInstantiationSummary; |
Max Moroz | fe4d904 | 2017-12-11 23:17:46 +0000 | [diff] [blame] | 36 | bool ExportSummaryOnly; |
Max Moroz | a80d9ce | 2019-03-14 17:49:27 +0000 | [diff] [blame] | 37 | bool SkipExpansions; |
| 38 | bool SkipFunctions; |
Vedant Kumar | ebe8401 | 2016-06-28 16:12:15 +0000 | [diff] [blame] | 39 | OutputFormat Format; |
Vedant Kumar | 7937ef3 | 2016-06-28 02:09:39 +0000 | [diff] [blame] | 40 | std::string ShowOutputDirectory; |
Vedant Kumar | 424f51b | 2016-07-15 22:44:57 +0000 | [diff] [blame] | 41 | std::vector<std::string> DemanglerOpts; |
Ying Yi | 0ef31b7 | 2016-08-04 10:39:43 +0000 | [diff] [blame] | 42 | uint32_t TabSize; |
Ying Yi | 84dc971 | 2016-08-24 14:27:23 +0000 | [diff] [blame] | 43 | std::string ProjectTitle; |
Ying Yi | 84dc971 | 2016-08-24 14:27:23 +0000 | [diff] [blame] | 44 | std::string CreatedTimeStr; |
Max Moroz | cc254ba | 2018-01-05 16:15:07 +0000 | [diff] [blame] | 45 | unsigned NumThreads; |
Alex Lorenz | e82d89c | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 46 | |
Adrian Prantl | 5f8f34e4 | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 47 | /// Change the output's stream color if the colors are enabled. |
Alex Lorenz | e82d89c | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 48 | ColoredRawOstream colored_ostream(raw_ostream &OS, |
Rui Ueyama | 4d41c33 | 2019-08-02 07:22:34 +0000 | [diff] [blame] | 49 | raw_ostream::Colors Color) const { |
Alex Lorenz | e82d89c | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 50 | return llvm::colored_ostream(OS, Color, Colors); |
| 51 | } |
Vedant Kumar | de717e6 | 2016-06-28 16:12:12 +0000 | [diff] [blame] | 52 | |
Adrian Prantl | 5f8f34e4 | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 53 | /// Check if an output directory has been specified. |
Vedant Kumar | 6ab6b36 | 2016-07-15 22:44:54 +0000 | [diff] [blame] | 54 | bool hasOutputDirectory() const { return !ShowOutputDirectory.empty(); } |
Vedant Kumar | 424f51b | 2016-07-15 22:44:57 +0000 | [diff] [blame] | 55 | |
Adrian Prantl | 5f8f34e4 | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 56 | /// Check if a demangler has been specified. |
Vedant Kumar | 424f51b | 2016-07-15 22:44:57 +0000 | [diff] [blame] | 57 | bool hasDemangler() const { return !DemanglerOpts.empty(); } |
Ying Yi | 84dc971 | 2016-08-24 14:27:23 +0000 | [diff] [blame] | 58 | |
Adrian Prantl | 5f8f34e4 | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 59 | /// Check if a project title has been specified. |
Ying Yi | 84dc971 | 2016-08-24 14:27:23 +0000 | [diff] [blame] | 60 | bool hasProjectTitle() const { return !ProjectTitle.empty(); } |
| 61 | |
Adrian Prantl | 5f8f34e4 | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 62 | /// Check if the created time of the profile data file is available. |
Ying Yi | 84dc971 | 2016-08-24 14:27:23 +0000 | [diff] [blame] | 63 | bool hasCreatedTime() const { return !CreatedTimeStr.empty(); } |
Ying Yi | 544b1df | 2016-09-13 11:28:31 +0000 | [diff] [blame] | 64 | |
Adrian Prantl | 5f8f34e4 | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 65 | /// Get the LLVM version string. |
Ying Yi | 544b1df | 2016-09-13 11:28:31 +0000 | [diff] [blame] | 66 | std::string getLLVMVersionString() const { |
| 67 | std::string VersionString = "Generated by llvm-cov -- llvm version "; |
| 68 | VersionString += LLVM_VERSION_STRING; |
| 69 | return VersionString; |
| 70 | } |
Alex Lorenz | e82d89c | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 71 | }; |
| 72 | } |
| 73 | |
| 74 | #endif // LLVM_COV_COVERAGEVIEWOPTIONS_H |