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
{
30 bool ShowRegionMarkers
;
31 bool ShowExpandedRegions
;
32 bool ShowFunctionInstantiations
;
33 bool ShowFullFilenames
;
34 bool ShowRegionSummary
;
35 bool ShowInstantiationSummary
;
36 bool ExportSummaryOnly
;
40 std::string ShowOutputDirectory
;
41 std::vector
<std::string
> DemanglerOpts
;
43 std::string ProjectTitle
;
44 std::string CreatedTimeStr
;
47 /// Change the output's stream color if the colors are enabled.
48 ColoredRawOstream
colored_ostream(raw_ostream
&OS
,
49 raw_ostream::Colors Color
) const {
50 return llvm::colored_ostream(OS
, Color
, Colors
);
53 /// Check if an output directory has been specified.
54 bool hasOutputDirectory() const { return !ShowOutputDirectory
.empty(); }
56 /// Check if a demangler has been specified.
57 bool hasDemangler() const { return !DemanglerOpts
.empty(); }
59 /// Check if a project title has been specified.
60 bool hasProjectTitle() const { return !ProjectTitle
.empty(); }
62 /// Check if the created time of the profile data file is available.
63 bool hasCreatedTime() const { return !CreatedTimeStr
.empty(); }
65 /// Get the LLVM version string.
66 std::string
getLLVMVersionString() const {
67 std::string VersionString
= "Generated by llvm-cov -- llvm version ";
68 VersionString
+= LLVM_VERSION_STRING
;
74 #endif // LLVM_COV_COVERAGEVIEWOPTIONS_H