Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / tools / llvm-cov / CoverageViewOptions.h
blobeb852859e9cbe46e156f2733a3b4b084e6211ec6
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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_COV_COVERAGEVIEWOPTIONS_H
10 #define LLVM_COV_COVERAGEVIEWOPTIONS_H
12 #include "llvm/Config/llvm-config.h"
13 #include "RenderingSupport.h"
14 #include <vector>
16 namespace llvm {
18 /// The options for displaying the code coverage information.
19 struct CoverageViewOptions {
20 enum class OutputFormat {
21 Text,
22 HTML,
23 Lcov
26 enum class BranchOutputType { Count, Percent, Off };
28 bool Debug;
29 bool Colors;
30 bool ShowLineNumbers;
31 bool ShowLineStats;
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 ShowDirectoryCoverage;
42 bool ExportSummaryOnly;
43 bool SkipExpansions;
44 bool SkipFunctions;
45 bool SkipBranches;
46 OutputFormat Format;
47 BranchOutputType ShowBranches;
48 std::string ShowOutputDirectory;
49 std::vector<std::string> DemanglerOpts;
50 uint32_t TabSize;
51 std::string ProjectTitle;
52 std::string CreatedTimeStr;
53 unsigned NumThreads;
54 std::string CompilationDirectory;
55 float HighCovWatermark;
56 float LowCovWatermark;
58 /// Change the output's stream color if the colors are enabled.
59 ColoredRawOstream colored_ostream(raw_ostream &OS,
60 raw_ostream::Colors Color) const {
61 return llvm::colored_ostream(OS, Color, Colors);
64 /// Check if an output directory has been specified.
65 bool hasOutputDirectory() const { return !ShowOutputDirectory.empty(); }
67 /// Check if a demangler has been specified.
68 bool hasDemangler() const { return !DemanglerOpts.empty(); }
70 /// Check if a project title has been specified.
71 bool hasProjectTitle() const { return !ProjectTitle.empty(); }
73 /// Check if the created time of the profile data file is available.
74 bool hasCreatedTime() const { return !CreatedTimeStr.empty(); }
76 /// Get the LLVM version string.
77 std::string getLLVMVersionString() const {
78 std::string VersionString = "Generated by llvm-cov -- llvm version ";
79 VersionString += LLVM_VERSION_STRING;
80 return VersionString;
85 #endif // LLVM_COV_COVERAGEVIEWOPTIONS_H