[clang][bytecode][NFC] Only get expr when checking for UB (#125397)
[llvm-project.git] / llvm / tools / llvm-cov / CoverageViewOptions.h
blob81e69c3814e30613eeb50fb6e624b16e95bc0d31
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 "RenderingSupport.h"
13 #include "llvm/Config/llvm-config.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 ShowMCDC;
34 bool ShowBranchCounts;
35 bool ShowBranchPercents;
36 bool ShowExpandedRegions;
37 bool ShowFunctionInstantiations;
38 bool ShowFullFilenames;
39 bool ShowBranchSummary;
40 bool ShowMCDCSummary;
41 bool ShowRegionSummary;
42 bool ShowInstantiationSummary;
43 bool ShowDirectoryCoverage;
44 bool ExportSummaryOnly;
45 bool SkipExpansions;
46 bool SkipFunctions;
47 bool SkipBranches;
48 bool BinaryCounters;
49 OutputFormat Format;
50 BranchOutputType ShowBranches;
51 std::string ShowOutputDirectory;
52 std::vector<std::string> DemanglerOpts;
53 uint32_t TabSize;
54 std::string ProjectTitle;
55 std::string CreatedTimeStr;
56 unsigned NumThreads;
57 std::string CompilationDirectory;
58 float HighCovWatermark;
59 float LowCovWatermark;
61 /// Change the output's stream color if the colors are enabled.
62 ColoredRawOstream colored_ostream(raw_ostream &OS,
63 raw_ostream::Colors Color) const {
64 return llvm::colored_ostream(OS, Color, Colors);
67 /// Check if an output directory has been specified.
68 bool hasOutputDirectory() const { return !ShowOutputDirectory.empty(); }
70 /// Check if a demangler has been specified.
71 bool hasDemangler() const { return !DemanglerOpts.empty(); }
73 /// Check if a project title has been specified.
74 bool hasProjectTitle() const { return !ProjectTitle.empty(); }
76 /// Check if the created time of the profile data file is available.
77 bool hasCreatedTime() const { return !CreatedTimeStr.empty(); }
79 /// Get the LLVM version string.
80 std::string getLLVMVersionString() const {
81 std::string VersionString = "Generated by llvm-cov -- llvm version ";
82 VersionString += LLVM_VERSION_STRING;
83 return VersionString;
88 #endif // LLVM_COV_COVERAGEVIEWOPTIONS_H