1 //===- CoverageViewOptions.h - Code coverage display options -------------===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_COV_COVERAGEVIEWOPTIONS_H
10 #define LLVM_COV_COVERAGEVIEWOPTIONS_H
12 #include "llvm/Config/llvm-config.h"
13 #include "RenderingSupport.h"
18 /// The options for displaying the code coverage information.
19 struct CoverageViewOptions
{
20 enum class OutputFormat
{
26 enum class BranchOutputType
{ Count
, Percent
, Off
};
32 bool ShowRegionMarkers
;
33 bool ShowBranchCounts
;
34 bool ShowBranchPercents
;
35 bool ShowExpandedRegions
;
36 bool ShowFunctionInstantiations
;
37 bool ShowFullFilenames
;
38 bool ShowBranchSummary
;
39 bool ShowRegionSummary
;
40 bool ShowInstantiationSummary
;
41 bool ExportSummaryOnly
;
45 BranchOutputType ShowBranches
;
46 std::string ShowOutputDirectory
;
47 std::vector
<std::string
> DemanglerOpts
;
49 std::string ProjectTitle
;
50 std::string CreatedTimeStr
;
52 std::string CompilationDirectory
;
53 float HighCovWatermark
;
54 float LowCovWatermark
;
56 /// Change the output's stream color if the colors are enabled.
57 ColoredRawOstream
colored_ostream(raw_ostream
&OS
,
58 raw_ostream::Colors Color
) const {
59 return llvm::colored_ostream(OS
, Color
, Colors
);
62 /// Check if an output directory has been specified.
63 bool hasOutputDirectory() const { return !ShowOutputDirectory
.empty(); }
65 /// Check if a demangler has been specified.
66 bool hasDemangler() const { return !DemanglerOpts
.empty(); }
68 /// Check if a project title has been specified.
69 bool hasProjectTitle() const { return !ProjectTitle
.empty(); }
71 /// Check if the created time of the profile data file is available.
72 bool hasCreatedTime() const { return !CreatedTimeStr
.empty(); }
74 /// Get the LLVM version string.
75 std::string
getLLVMVersionString() const {
76 std::string VersionString
= "Generated by llvm-cov -- llvm version ";
77 VersionString
+= LLVM_VERSION_STRING
;
83 #endif // LLVM_COV_COVERAGEVIEWOPTIONS_H