1 | //===--- DependencyOutputOptions.h ------------------------------*- C++ -*-===// |
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 | //===----------------------------------------------------------------------===// |
8 | |
9 | #ifndef LLVM_CLANG_FRONTEND_DEPENDENCYOUTPUTOPTIONS_H |
10 | #define LLVM_CLANG_FRONTEND_DEPENDENCYOUTPUTOPTIONS_H |
11 | |
12 | #include "clang/Basic/HeaderInclude.h" |
13 | #include <string> |
14 | #include <vector> |
15 | |
16 | namespace clang { |
17 | |
18 | /// ShowIncludesDestination - Destination for /showIncludes output. |
19 | enum class ShowIncludesDestination { None, Stdout, Stderr }; |
20 | |
21 | /// DependencyOutputFormat - Format for the compiler dependency file. |
22 | enum class DependencyOutputFormat { Make, NMake }; |
23 | |
24 | /// ExtraDepKind - The kind of extra dependency file. |
25 | enum { |
26 | EDK_SanitizeIgnorelist, |
27 | EDK_ProfileList, |
28 | EDK_ModuleFile, |
29 | EDK_DepFileEntry, |
30 | }; |
31 | |
32 | /// DependencyOutputOptions - Options for controlling the compiler dependency |
33 | /// file generation. |
34 | class DependencyOutputOptions { |
35 | public: |
36 | LLVM_PREFERRED_TYPE(bool) |
37 | unsigned : 1; ///< Include system header dependencies. |
38 | LLVM_PREFERRED_TYPE(bool) |
39 | unsigned : 1; ///< Show header inclusions (-H). |
40 | LLVM_PREFERRED_TYPE(bool) |
41 | unsigned UsePhonyTargets : 1; ///< Include phony targets for each |
42 | /// dependency, which can avoid some 'make' |
43 | /// problems. |
44 | LLVM_PREFERRED_TYPE(bool) |
45 | unsigned : 1; ///< Add missing headers to dependency list |
46 | LLVM_PREFERRED_TYPE(bool) |
47 | unsigned IncludeModuleFiles : 1; ///< Include module file dependencies. |
48 | LLVM_PREFERRED_TYPE(bool) |
49 | unsigned : 1; ///< With ShowHeaderIncludes, show |
50 | /// also includes that were skipped |
51 | /// due to the "include guard |
52 | /// optimization" or #pragma once. |
53 | |
54 | /// The format of header information. |
55 | HeaderIncludeFormatKind = HIFMT_Textual; |
56 | |
57 | /// Determine whether header information should be filtered. |
58 | HeaderIncludeFilteringKind = HIFIL_None; |
59 | |
60 | /// Destination of cl.exe style /showIncludes info. |
61 | ShowIncludesDestination ShowIncludesDest = ShowIncludesDestination::None; |
62 | |
63 | /// The format for the dependency file. |
64 | DependencyOutputFormat OutputFormat = DependencyOutputFormat::Make; |
65 | |
66 | /// The file to write dependency output to. |
67 | std::string OutputFile; |
68 | |
69 | /// The file to write header include output to. This is orthogonal to |
70 | /// ShowHeaderIncludes (-H) and will include headers mentioned in the |
71 | /// predefines buffer. If the output file is "-", output will be sent to |
72 | /// stderr. |
73 | std::string ; |
74 | |
75 | /// A list of names to use as the targets in the dependency file; this list |
76 | /// must contain at least one entry. |
77 | std::vector<std::string> Targets; |
78 | |
79 | /// A list of extra dependencies (filename and kind) to be used for every |
80 | /// target. |
81 | std::vector<std::pair<std::string, ExtraDepKind>> ; |
82 | |
83 | /// The file to write GraphViz-formatted header dependencies to. |
84 | std::string DOTOutputFile; |
85 | |
86 | /// The directory to copy module dependencies to when collecting them. |
87 | std::string ModuleDependencyOutputDir; |
88 | |
89 | public: |
90 | DependencyOutputOptions() |
91 | : IncludeSystemHeaders(0), ShowHeaderIncludes(0), UsePhonyTargets(0), |
92 | AddMissingHeaderDeps(0), IncludeModuleFiles(0), |
93 | ShowSkippedHeaderIncludes(0), HeaderIncludeFormat(HIFMT_Textual), |
94 | HeaderIncludeFiltering(HIFIL_None) {} |
95 | }; |
96 | |
97 | } // end namespace clang |
98 | |
99 | #endif |
100 | |