Alex Lorenz | 6c7a6a1 | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 1 | //===- 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 Weber | 2bcb333 | 2018-04-25 18:34:00 +0000 | [diff] [blame] | 13 | #include "llvm/Config/llvm-config.h" |
Alex Lorenz | 6c7a6a1 | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 14 | #include "RenderingSupport.h" |
Vedant Kumar | 13ca1cc | 2016-07-15 22:44:57 +0000 | [diff] [blame] | 15 | #include <vector> |
Alex Lorenz | 6c7a6a1 | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 16 | |
| 17 | namespace llvm { |
| 18 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 19 | /// The options for displaying the code coverage information. |
Alex Lorenz | 6c7a6a1 | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 20 | struct CoverageViewOptions { |
Vedant Kumar | 0347ce7 | 2016-06-28 00:15:54 +0000 | [diff] [blame] | 21 | enum class OutputFormat { |
Vedant Kumar | 55c8c00 | 2016-07-06 21:44:05 +0000 | [diff] [blame] | 22 | Text, |
Max Moroz | fcdc267 | 2018-11-09 16:10:44 +0000 | [diff] [blame] | 23 | HTML, |
| 24 | Lcov |
Vedant Kumar | 0347ce7 | 2016-06-28 00:15:54 +0000 | [diff] [blame] | 25 | }; |
| 26 | |
Alex Lorenz | 6c7a6a1 | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 27 | bool Debug; |
| 28 | bool Colors; |
| 29 | bool ShowLineNumbers; |
| 30 | bool ShowLineStats; |
| 31 | bool ShowRegionMarkers; |
Alex Lorenz | 6c7a6a1 | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 32 | bool ShowExpandedRegions; |
| 33 | bool ShowFunctionInstantiations; |
Vedant Kumar | 97c9f0c | 2015-09-14 23:26:36 +0000 | [diff] [blame] | 34 | bool ShowFullFilenames; |
Eli Friedman | d3822e4 | 2017-09-11 22:56:20 +0000 | [diff] [blame] | 35 | bool ShowRegionSummary; |
| 36 | bool ShowInstantiationSummary; |
Max Moroz | d4b0ab0 | 2017-12-11 23:17:46 +0000 | [diff] [blame] | 37 | bool ExportSummaryOnly; |
Vedant Kumar | c5fab6a | 2016-06-28 16:12:15 +0000 | [diff] [blame] | 38 | OutputFormat Format; |
Vedant Kumar | 40a78f8 | 2016-06-28 02:09:39 +0000 | [diff] [blame] | 39 | std::string ShowOutputDirectory; |
Vedant Kumar | 13ca1cc | 2016-07-15 22:44:57 +0000 | [diff] [blame] | 40 | std::vector<std::string> DemanglerOpts; |
Ying Yi | 65787e2 | 2016-08-04 10:39:43 +0000 | [diff] [blame] | 41 | uint32_t TabSize; |
Ying Yi | 1461e99 | 2016-08-24 14:27:23 +0000 | [diff] [blame] | 42 | std::string ProjectTitle; |
Ying Yi | 1461e99 | 2016-08-24 14:27:23 +0000 | [diff] [blame] | 43 | std::string CreatedTimeStr; |
Max Moroz | d6352ca | 2018-01-05 16:15:07 +0000 | [diff] [blame] | 44 | unsigned NumThreads; |
Alex Lorenz | 6c7a6a1 | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 45 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 46 | /// Change the output's stream color if the colors are enabled. |
Alex Lorenz | 6c7a6a1 | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 47 | ColoredRawOstream colored_ostream(raw_ostream &OS, |
| 48 | raw_ostream::Colors Color) const { |
| 49 | return llvm::colored_ostream(OS, Color, Colors); |
| 50 | } |
Vedant Kumar | e017372 | 2016-06-28 16:12:12 +0000 | [diff] [blame] | 51 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 52 | /// Check if an output directory has been specified. |
Vedant Kumar | a5ec41d | 2016-07-15 22:44:54 +0000 | [diff] [blame] | 53 | bool hasOutputDirectory() const { return !ShowOutputDirectory.empty(); } |
Vedant Kumar | 13ca1cc | 2016-07-15 22:44:57 +0000 | [diff] [blame] | 54 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 55 | /// Check if a demangler has been specified. |
Vedant Kumar | 13ca1cc | 2016-07-15 22:44:57 +0000 | [diff] [blame] | 56 | bool hasDemangler() const { return !DemanglerOpts.empty(); } |
Ying Yi | 1461e99 | 2016-08-24 14:27:23 +0000 | [diff] [blame] | 57 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 58 | /// Check if a project title has been specified. |
Ying Yi | 1461e99 | 2016-08-24 14:27:23 +0000 | [diff] [blame] | 59 | bool hasProjectTitle() const { return !ProjectTitle.empty(); } |
| 60 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 61 | /// Check if the created time of the profile data file is available. |
Ying Yi | 1461e99 | 2016-08-24 14:27:23 +0000 | [diff] [blame] | 62 | bool hasCreatedTime() const { return !CreatedTimeStr.empty(); } |
Ying Yi | 503f462 | 2016-09-13 11:28:31 +0000 | [diff] [blame] | 63 | |
Adrian Prantl | 26b584c | 2018-05-01 15:54:18 +0000 | [diff] [blame] | 64 | /// Get the LLVM version string. |
Ying Yi | 503f462 | 2016-09-13 11:28:31 +0000 | [diff] [blame] | 65 | std::string getLLVMVersionString() const { |
| 66 | std::string VersionString = "Generated by llvm-cov -- llvm version "; |
| 67 | VersionString += LLVM_VERSION_STRING; |
| 68 | return VersionString; |
| 69 | } |
Alex Lorenz | 6c7a6a1 | 2014-08-22 22:56:03 +0000 | [diff] [blame] | 70 | }; |
| 71 | } |
| 72 | |
| 73 | #endif // LLVM_COV_COVERAGEVIEWOPTIONS_H |