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 <string> 13 #include <vector> 14 15 namespace clang { 16 17 /// ShowIncludesDestination - Destination for /showIncludes output. 18 enum class ShowIncludesDestination { None, Stdout, Stderr }; 19 20 /// DependencyOutputFormat - Format for the compiler dependency file. 21 enum class DependencyOutputFormat { Make, NMake }; 22 23 /// DependencyOutputOptions - Options for controlling the compiler dependency 24 /// file generation. 25 class DependencyOutputOptions { 26 public: 27 unsigned IncludeSystemHeaders : 1; ///< Include system header dependencies. 28 unsigned ShowHeaderIncludes : 1; ///< Show header inclusions (-H). 29 unsigned UsePhonyTargets : 1; ///< Include phony targets for each 30 /// dependency, which can avoid some 'make' 31 /// problems. 32 unsigned AddMissingHeaderDeps : 1; ///< Add missing headers to dependency list 33 unsigned IncludeModuleFiles : 1; ///< Include module file dependencies. 34 35 /// Destination of cl.exe style /showIncludes info. 36 ShowIncludesDestination ShowIncludesDest = ShowIncludesDestination::None; 37 38 /// The format for the dependency file. 39 DependencyOutputFormat OutputFormat = DependencyOutputFormat::Make; 40 41 /// The file to write dependency output to. 42 std::string OutputFile; 43 44 /// The file to write header include output to. This is orthogonal to 45 /// ShowHeaderIncludes (-H) and will include headers mentioned in the 46 /// predefines buffer. If the output file is "-", output will be sent to 47 /// stderr. 48 std::string HeaderIncludeOutputFile; 49 50 /// A list of names to use as the targets in the dependency file; this list 51 /// must contain at least one entry. 52 std::vector<std::string> Targets; 53 54 /// A list of filenames to be used as extra dependencies for every target. 55 std::vector<std::string> ExtraDeps; 56 57 /// In /showIncludes mode, pretend the main TU is a header with this name. 58 std::string ShowIncludesPretendHeader; 59 60 /// The file to write GraphViz-formatted header dependencies to. 61 std::string DOTOutputFile; 62 63 /// The directory to copy module dependencies to when collecting them. 64 std::string ModuleDependencyOutputDir; 65 66 public: DependencyOutputOptions()67 DependencyOutputOptions() 68 : IncludeSystemHeaders(0), ShowHeaderIncludes(0), UsePhonyTargets(0), 69 AddMissingHeaderDeps(0), IncludeModuleFiles(0) {} 70 }; 71 72 } // end namespace clang 73 74 #endif 75