DependencyOutputOptions.h 3.8 KB

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