Flang.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. //===--- Flang.h - Flang Tool and ToolChain Implementations ====-*- 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. #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FLANG_H
  9. #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FLANG_H
  10. #include "clang/Driver/Tool.h"
  11. #include "clang/Driver/Action.h"
  12. #include "clang/Driver/Compilation.h"
  13. #include "clang/Driver/ToolChain.h"
  14. #include "llvm/Option/ArgList.h"
  15. #include "llvm/Support/Compiler.h"
  16. namespace clang {
  17. namespace driver {
  18. namespace tools {
  19. /// Flang compiler tool.
  20. class LLVM_LIBRARY_VISIBILITY Flang : public Tool {
  21. private:
  22. /// Extract fortran dialect options from the driver arguments and add them to
  23. /// the list of arguments for the generated command/job.
  24. ///
  25. /// \param [in] Args The list of input driver arguments
  26. /// \param [out] CmdArgs The list of output command arguments
  27. void addFortranDialectOptions(const llvm::opt::ArgList &Args,
  28. llvm::opt::ArgStringList &CmdArgs) const;
  29. /// Extract preprocessing options from the driver arguments and add them to
  30. /// the preprocessor command arguments.
  31. ///
  32. /// \param [in] Args The list of input driver arguments
  33. /// \param [out] CmdArgs The list of output command arguments
  34. void addPreprocessingOptions(const llvm::opt::ArgList &Args,
  35. llvm::opt::ArgStringList &CmdArgs) const;
  36. /// Extract PIC options from the driver arguments and add them to
  37. /// the command arguments.
  38. ///
  39. /// \param [in] Args The list of input driver arguments
  40. /// \param [out] CmdArgs The list of output command arguments
  41. void addPicOptions(const llvm::opt::ArgList &Args,
  42. llvm::opt::ArgStringList &CmdArgs) const;
  43. /// Extract target options from the driver arguments and add them to
  44. /// the command arguments.
  45. ///
  46. /// \param [in] Args The list of input driver arguments
  47. /// \param [out] CmdArgs The list of output command arguments
  48. void addTargetOptions(const llvm::opt::ArgList &Args,
  49. llvm::opt::ArgStringList &CmdArgs) const;
  50. /// Extract other compilation options from the driver arguments and add them
  51. /// to the command arguments.
  52. ///
  53. /// \param [in] Args The list of input driver arguments
  54. /// \param [out] CmdArgs The list of output command arguments
  55. void addOtherOptions(const llvm::opt::ArgList &Args,
  56. llvm::opt::ArgStringList &CmdArgs) const;
  57. public:
  58. Flang(const ToolChain &TC);
  59. ~Flang() override;
  60. bool hasGoodDiagnostics() const override { return true; }
  61. bool hasIntegratedAssembler() const override { return true; }
  62. bool hasIntegratedCPP() const override { return true; }
  63. bool canEmitIR() const override { return true; }
  64. void ConstructJob(Compilation &C, const JobAction &JA,
  65. const InputInfo &Output, const InputInfoList &Inputs,
  66. const llvm::opt::ArgList &TCArgs,
  67. const char *LinkingOutput) const override;
  68. };
  69. } // end namespace tools
  70. } // end namespace driver
  71. } // end namespace clang
  72. #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FLANG_H