xref: /netbsd-src/external/apache2/llvm/dist/clang/lib/Driver/ToolChains/Flang.h (revision e038c9c4676b0f19b1b7dd08a940c6ed64a6d5ae)
1*e038c9c4Sjoerg //===--- Flang.h - Flang Tool and ToolChain Implementations ====-*- C++ -*-===//
2*e038c9c4Sjoerg //
3*e038c9c4Sjoerg // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*e038c9c4Sjoerg // See https://llvm.org/LICENSE.txt for license information.
5*e038c9c4Sjoerg // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*e038c9c4Sjoerg //
7*e038c9c4Sjoerg //===----------------------------------------------------------------------===//
8*e038c9c4Sjoerg 
9*e038c9c4Sjoerg #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FLANG_H
10*e038c9c4Sjoerg #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FLANG_H
11*e038c9c4Sjoerg 
12*e038c9c4Sjoerg #include "clang/Driver/Tool.h"
13*e038c9c4Sjoerg #include "clang/Driver/Action.h"
14*e038c9c4Sjoerg #include "clang/Driver/Compilation.h"
15*e038c9c4Sjoerg #include "clang/Driver/ToolChain.h"
16*e038c9c4Sjoerg #include "llvm/Option/ArgList.h"
17*e038c9c4Sjoerg #include "llvm/Support/Compiler.h"
18*e038c9c4Sjoerg 
19*e038c9c4Sjoerg namespace clang {
20*e038c9c4Sjoerg namespace driver {
21*e038c9c4Sjoerg 
22*e038c9c4Sjoerg namespace tools {
23*e038c9c4Sjoerg 
24*e038c9c4Sjoerg /// Flang compiler tool.
25*e038c9c4Sjoerg class LLVM_LIBRARY_VISIBILITY Flang : public Tool {
26*e038c9c4Sjoerg private:
27*e038c9c4Sjoerg   /// Extract fortran dialect options from the driver arguments and add them to
28*e038c9c4Sjoerg   /// the list of arguments for the generated command/job.
29*e038c9c4Sjoerg   ///
30*e038c9c4Sjoerg   /// \param [in] Args The list of input driver arguments
31*e038c9c4Sjoerg   /// \param [out] CmdArgs The list of output command arguments
32*e038c9c4Sjoerg   void AddFortranDialectOptions(const llvm::opt::ArgList &Args,
33*e038c9c4Sjoerg                                 llvm::opt::ArgStringList &CmdArgs) const;
34*e038c9c4Sjoerg 
35*e038c9c4Sjoerg   /// Extract preprocessing options from the driver arguments and add them to
36*e038c9c4Sjoerg   /// the preprocessor command arguments.
37*e038c9c4Sjoerg   ///
38*e038c9c4Sjoerg   /// \param [in] Args The list of input driver arguments
39*e038c9c4Sjoerg   /// \param [out] CmdArgs The list of output command arguments
40*e038c9c4Sjoerg   void AddPreprocessingOptions(const llvm::opt::ArgList &Args,
41*e038c9c4Sjoerg                                llvm::opt::ArgStringList &CmdArgs) const;
42*e038c9c4Sjoerg   /// Extract other compilation options from the driver arguments and add them
43*e038c9c4Sjoerg   /// to the command arguments.
44*e038c9c4Sjoerg   ///
45*e038c9c4Sjoerg   /// \param [in] Args The list of input driver arguments
46*e038c9c4Sjoerg   /// \param [out] CmdArgs The list of output command arguments
47*e038c9c4Sjoerg   void AddOtherOptions(const llvm::opt::ArgList &Args,
48*e038c9c4Sjoerg                        llvm::opt::ArgStringList &CmdArgs) const;
49*e038c9c4Sjoerg 
50*e038c9c4Sjoerg public:
51*e038c9c4Sjoerg   Flang(const ToolChain &TC);
52*e038c9c4Sjoerg   ~Flang() override;
53*e038c9c4Sjoerg 
hasGoodDiagnostics()54*e038c9c4Sjoerg   bool hasGoodDiagnostics() const override { return true; }
hasIntegratedAssembler()55*e038c9c4Sjoerg   bool hasIntegratedAssembler() const override { return true; }
hasIntegratedCPP()56*e038c9c4Sjoerg   bool hasIntegratedCPP() const override { return true; }
canEmitIR()57*e038c9c4Sjoerg   bool canEmitIR() const override { return true; }
58*e038c9c4Sjoerg 
59*e038c9c4Sjoerg   void ConstructJob(Compilation &C, const JobAction &JA,
60*e038c9c4Sjoerg                     const InputInfo &Output, const InputInfoList &Inputs,
61*e038c9c4Sjoerg                     const llvm::opt::ArgList &TCArgs,
62*e038c9c4Sjoerg                     const char *LinkingOutput) const override;
63*e038c9c4Sjoerg };
64*e038c9c4Sjoerg 
65*e038c9c4Sjoerg } // end namespace tools
66*e038c9c4Sjoerg 
67*e038c9c4Sjoerg } // end namespace driver
68*e038c9c4Sjoerg } // end namespace clang
69*e038c9c4Sjoerg 
70*e038c9c4Sjoerg #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FLANG_H
71