DependencyOutputOptions.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===--- DependencyOutputOptions.h ------------------------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_CLANG_FRONTEND_DEPENDENCYOUTPUTOPTIONS_H
  14. #define LLVM_CLANG_FRONTEND_DEPENDENCYOUTPUTOPTIONS_H
  15. #include <string>
  16. #include <vector>
  17. namespace clang {
  18. /// ShowIncludesDestination - Destination for /showIncludes output.
  19. enum class ShowIncludesDestination { None, Stdout, Stderr };
  20. /// DependencyOutputFormat - Format for the compiler dependency file.
  21. enum class DependencyOutputFormat { Make, NMake };
  22. /// ExtraDepKind - The kind of extra dependency file.
  23. enum ExtraDepKind {
  24. EDK_SanitizeIgnorelist,
  25. EDK_ProfileList,
  26. EDK_ModuleFile,
  27. EDK_DepFileEntry,
  28. };
  29. /// DependencyOutputOptions - Options for controlling the compiler dependency
  30. /// file generation.
  31. class DependencyOutputOptions {
  32. public:
  33. unsigned IncludeSystemHeaders : 1; ///< Include system header dependencies.
  34. unsigned ShowHeaderIncludes : 1; ///< Show header inclusions (-H).
  35. unsigned UsePhonyTargets : 1; ///< Include phony targets for each
  36. /// dependency, which can avoid some 'make'
  37. /// problems.
  38. unsigned AddMissingHeaderDeps : 1; ///< Add missing headers to dependency list
  39. unsigned IncludeModuleFiles : 1; ///< Include module file dependencies.
  40. unsigned ShowSkippedHeaderIncludes : 1; ///< With ShowHeaderIncludes, show
  41. /// also includes that were skipped
  42. /// due to the "include guard
  43. /// optimization" or #pragma once.
  44. /// Destination of cl.exe style /showIncludes info.
  45. ShowIncludesDestination ShowIncludesDest = ShowIncludesDestination::None;
  46. /// The format for the dependency file.
  47. DependencyOutputFormat OutputFormat = DependencyOutputFormat::Make;
  48. /// The file to write dependency output to.
  49. std::string OutputFile;
  50. /// The file to write header include output to. This is orthogonal to
  51. /// ShowHeaderIncludes (-H) and will include headers mentioned in the
  52. /// predefines buffer. If the output file is "-", output will be sent to
  53. /// stderr.
  54. std::string HeaderIncludeOutputFile;
  55. /// A list of names to use as the targets in the dependency file; this list
  56. /// must contain at least one entry.
  57. std::vector<std::string> Targets;
  58. /// A list of extra dependencies (filename and kind) to be used for every
  59. /// target.
  60. std::vector<std::pair<std::string, ExtraDepKind>> ExtraDeps;
  61. /// In /showIncludes mode, pretend the main TU is a header with this name.
  62. std::string ShowIncludesPretendHeader;
  63. /// The file to write GraphViz-formatted header dependencies to.
  64. std::string DOTOutputFile;
  65. /// The directory to copy module dependencies to when collecting them.
  66. std::string ModuleDependencyOutputDir;
  67. public:
  68. DependencyOutputOptions()
  69. : IncludeSystemHeaders(0), ShowHeaderIncludes(0), UsePhonyTargets(0),
  70. AddMissingHeaderDeps(0), IncludeModuleFiles(0),
  71. ShowSkippedHeaderIncludes(0) {}
  72. };
  73. } // end namespace clang
  74. #endif
  75. #ifdef __GNUC__
  76. #pragma GCC diagnostic pop
  77. #endif