]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/llvm-cov/CoverageViewOptions.h
Merge clang 7.0.1 and several follow-up changes
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / llvm-cov / CoverageViewOptions.h
1 //===- CoverageViewOptions.h - Code coverage display options -------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_COV_COVERAGEVIEWOPTIONS_H
11 #define LLVM_COV_COVERAGEVIEWOPTIONS_H
12
13 #include "llvm/Config/llvm-config.h"
14 #include "RenderingSupport.h"
15 #include <vector>
16
17 namespace llvm {
18
19 /// The options for displaying the code coverage information.
20 struct CoverageViewOptions {
21   enum class OutputFormat {
22     Text,
23     HTML
24   };
25
26   bool Debug;
27   bool Colors;
28   bool ShowLineNumbers;
29   bool ShowLineStats;
30   bool ShowRegionMarkers;
31   bool ShowExpandedRegions;
32   bool ShowFunctionInstantiations;
33   bool ShowFullFilenames;
34   bool ShowRegionSummary;
35   bool ShowInstantiationSummary;
36   bool ExportSummaryOnly;
37   OutputFormat Format;
38   std::string ShowOutputDirectory;
39   std::vector<std::string> DemanglerOpts;
40   uint32_t TabSize;
41   std::string ProjectTitle;
42   std::string CreatedTimeStr;
43   unsigned NumThreads;
44
45   /// Change the output's stream color if the colors are enabled.
46   ColoredRawOstream colored_ostream(raw_ostream &OS,
47                                     raw_ostream::Colors Color) const {
48     return llvm::colored_ostream(OS, Color, Colors);
49   }
50
51   /// Check if an output directory has been specified.
52   bool hasOutputDirectory() const { return !ShowOutputDirectory.empty(); }
53
54   /// Check if a demangler has been specified.
55   bool hasDemangler() const { return !DemanglerOpts.empty(); }
56
57   /// Check if a project title has been specified.
58   bool hasProjectTitle() const { return !ProjectTitle.empty(); }
59
60   /// Check if the created time of the profile data file is available.
61   bool hasCreatedTime() const { return !CreatedTimeStr.empty(); }
62
63   /// Get the LLVM version string.
64   std::string getLLVMVersionString() const {
65     std::string VersionString = "Generated by llvm-cov -- llvm version ";
66     VersionString += LLVM_VERSION_STRING;
67     return VersionString;
68   }
69 };
70 }
71
72 #endif // LLVM_COV_COVERAGEVIEWOPTIONS_H