xref: /freebsd/contrib/llvm-project/llvm/tools/llvm-cov/CoverageViewOptions.h (revision 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
10b57cec5SDimitry Andric //===- CoverageViewOptions.h - Code coverage display options -------------===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric 
90b57cec5SDimitry Andric #ifndef LLVM_COV_COVERAGEVIEWOPTIONS_H
100b57cec5SDimitry Andric #define LLVM_COV_COVERAGEVIEWOPTIONS_H
110b57cec5SDimitry Andric 
120b57cec5SDimitry Andric #include "llvm/Config/llvm-config.h"
130b57cec5SDimitry Andric #include "RenderingSupport.h"
140b57cec5SDimitry Andric #include <vector>
150b57cec5SDimitry Andric 
160b57cec5SDimitry Andric namespace llvm {
170b57cec5SDimitry Andric 
180b57cec5SDimitry Andric /// The options for displaying the code coverage information.
190b57cec5SDimitry Andric struct CoverageViewOptions {
200b57cec5SDimitry Andric   enum class OutputFormat {
210b57cec5SDimitry Andric     Text,
220b57cec5SDimitry Andric     HTML,
230b57cec5SDimitry Andric     Lcov
240b57cec5SDimitry Andric   };
250b57cec5SDimitry Andric 
26e8d8bef9SDimitry Andric   enum class BranchOutputType { Count, Percent, Off };
27e8d8bef9SDimitry Andric 
280b57cec5SDimitry Andric   bool Debug;
290b57cec5SDimitry Andric   bool Colors;
300b57cec5SDimitry Andric   bool ShowLineNumbers;
310b57cec5SDimitry Andric   bool ShowLineStats;
320b57cec5SDimitry Andric   bool ShowRegionMarkers;
33*5f757f3fSDimitry Andric   bool ShowMCDC;
34e8d8bef9SDimitry Andric   bool ShowBranchCounts;
35e8d8bef9SDimitry Andric   bool ShowBranchPercents;
360b57cec5SDimitry Andric   bool ShowExpandedRegions;
370b57cec5SDimitry Andric   bool ShowFunctionInstantiations;
380b57cec5SDimitry Andric   bool ShowFullFilenames;
39e8d8bef9SDimitry Andric   bool ShowBranchSummary;
40*5f757f3fSDimitry Andric   bool ShowMCDCSummary;
410b57cec5SDimitry Andric   bool ShowRegionSummary;
420b57cec5SDimitry Andric   bool ShowInstantiationSummary;
43*5f757f3fSDimitry Andric   bool ShowDirectoryCoverage;
440b57cec5SDimitry Andric   bool ExportSummaryOnly;
450b57cec5SDimitry Andric   bool SkipExpansions;
460b57cec5SDimitry Andric   bool SkipFunctions;
47bdd1243dSDimitry Andric   bool SkipBranches;
480b57cec5SDimitry Andric   OutputFormat Format;
49e8d8bef9SDimitry Andric   BranchOutputType ShowBranches;
500b57cec5SDimitry Andric   std::string ShowOutputDirectory;
510b57cec5SDimitry Andric   std::vector<std::string> DemanglerOpts;
520b57cec5SDimitry Andric   uint32_t TabSize;
530b57cec5SDimitry Andric   std::string ProjectTitle;
540b57cec5SDimitry Andric   std::string CreatedTimeStr;
550b57cec5SDimitry Andric   unsigned NumThreads;
56fe6060f1SDimitry Andric   std::string CompilationDirectory;
5781ad6265SDimitry Andric   float HighCovWatermark;
5881ad6265SDimitry Andric   float LowCovWatermark;
590b57cec5SDimitry Andric 
600b57cec5SDimitry Andric   /// Change the output's stream color if the colors are enabled.
610b57cec5SDimitry Andric   ColoredRawOstream colored_ostream(raw_ostream &OS,
620b57cec5SDimitry Andric                                     raw_ostream::Colors Color) const {
630b57cec5SDimitry Andric     return llvm::colored_ostream(OS, Color, Colors);
640b57cec5SDimitry Andric   }
650b57cec5SDimitry Andric 
660b57cec5SDimitry Andric   /// Check if an output directory has been specified.
670b57cec5SDimitry Andric   bool hasOutputDirectory() const { return !ShowOutputDirectory.empty(); }
680b57cec5SDimitry Andric 
690b57cec5SDimitry Andric   /// Check if a demangler has been specified.
700b57cec5SDimitry Andric   bool hasDemangler() const { return !DemanglerOpts.empty(); }
710b57cec5SDimitry Andric 
720b57cec5SDimitry Andric   /// Check if a project title has been specified.
730b57cec5SDimitry Andric   bool hasProjectTitle() const { return !ProjectTitle.empty(); }
740b57cec5SDimitry Andric 
750b57cec5SDimitry Andric   /// Check if the created time of the profile data file is available.
760b57cec5SDimitry Andric   bool hasCreatedTime() const { return !CreatedTimeStr.empty(); }
770b57cec5SDimitry Andric 
780b57cec5SDimitry Andric   /// Get the LLVM version string.
790b57cec5SDimitry Andric   std::string getLLVMVersionString() const {
800b57cec5SDimitry Andric     std::string VersionString = "Generated by llvm-cov -- llvm version ";
810b57cec5SDimitry Andric     VersionString += LLVM_VERSION_STRING;
820b57cec5SDimitry Andric     return VersionString;
830b57cec5SDimitry Andric   }
840b57cec5SDimitry Andric };
850b57cec5SDimitry Andric }
860b57cec5SDimitry Andric 
870b57cec5SDimitry Andric #endif // LLVM_COV_COVERAGEVIEWOPTIONS_H
88