1 | //===- CoverageViewOptions.h - Code coverage display options -------------===// |
2 | // |
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 |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #ifndef LLVM_COV_COVERAGEVIEWOPTIONS_H |
10 | #define LLVM_COV_COVERAGEVIEWOPTIONS_H |
11 | |
12 | #include "RenderingSupport.h" |
13 | #include "llvm/Config/llvm-config.h" |
14 | #include <vector> |
15 | |
16 | namespace llvm { |
17 | |
18 | /// The options for displaying the code coverage information. |
19 | struct CoverageViewOptions { |
20 | enum class OutputFormat { |
21 | Text, |
22 | HTML, |
23 | Lcov |
24 | }; |
25 | |
26 | enum class BranchOutputType { Count, Percent, Off }; |
27 | |
28 | bool Debug; |
29 | bool Colors; |
30 | bool ShowLineNumbers; |
31 | bool ShowLineStats; |
32 | bool ShowRegionMarkers; |
33 | bool ShowMCDC; |
34 | bool ShowBranchCounts; |
35 | bool ShowBranchPercents; |
36 | bool ShowExpandedRegions; |
37 | bool ShowFunctionInstantiations; |
38 | bool UnifyFunctionInstantiations; |
39 | bool ShowFullFilenames; |
40 | bool ShowBranchSummary; |
41 | bool ShowMCDCSummary; |
42 | bool ShowRegionSummary; |
43 | bool ShowInstantiationSummary; |
44 | bool ShowDirectoryCoverage; |
45 | bool ExportSummaryOnly; |
46 | bool SkipExpansions; |
47 | bool SkipFunctions; |
48 | bool SkipBranches; |
49 | bool BinaryCounters; |
50 | OutputFormat Format; |
51 | BranchOutputType ShowBranches; |
52 | std::string ShowOutputDirectory; |
53 | std::vector<std::string> DemanglerOpts; |
54 | uint32_t TabSize; |
55 | std::string ProjectTitle; |
56 | std::string CreatedTimeStr; |
57 | unsigned NumThreads; |
58 | std::string CompilationDirectory; |
59 | float HighCovWatermark; |
60 | float LowCovWatermark; |
61 | |
62 | /// Change the output's stream color if the colors are enabled. |
63 | ColoredRawOstream colored_ostream(raw_ostream &OS, |
64 | raw_ostream::Colors Color) const { |
65 | return llvm::colored_ostream(OS, Color, IsColorUsed: Colors); |
66 | } |
67 | |
68 | /// Check if an output directory has been specified. |
69 | bool hasOutputDirectory() const { return !ShowOutputDirectory.empty(); } |
70 | |
71 | /// Check if a demangler has been specified. |
72 | bool hasDemangler() const { return !DemanglerOpts.empty(); } |
73 | |
74 | /// Check if a project title has been specified. |
75 | bool hasProjectTitle() const { return !ProjectTitle.empty(); } |
76 | |
77 | /// Check if the created time of the profile data file is available. |
78 | bool hasCreatedTime() const { return !CreatedTimeStr.empty(); } |
79 | |
80 | /// Get the LLVM version string. |
81 | std::string getLLVMVersionString() const { |
82 | std::string VersionString = "Generated by llvm-cov -- llvm version " ; |
83 | VersionString += LLVM_VERSION_STRING; |
84 | return VersionString; |
85 | } |
86 | }; |
87 | } |
88 | |
89 | #endif // LLVM_COV_COVERAGEVIEWOPTIONS_H |
90 | |