xref: /freebsd/contrib/llvm-project/clang/lib/Driver/ToolChains/Flang.h (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
1480093f4SDimitry Andric //===--- Flang.h - Flang Tool and ToolChain Implementations ====-*- C++ -*-===//
2480093f4SDimitry Andric //
3480093f4SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4480093f4SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5480093f4SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6480093f4SDimitry Andric //
7480093f4SDimitry Andric //===----------------------------------------------------------------------===//
8480093f4SDimitry Andric 
9480093f4SDimitry Andric #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FLANG_H
10480093f4SDimitry Andric #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FLANG_H
11480093f4SDimitry Andric 
12480093f4SDimitry Andric #include "clang/Driver/Tool.h"
13480093f4SDimitry Andric #include "clang/Driver/Action.h"
14480093f4SDimitry Andric #include "clang/Driver/Compilation.h"
15480093f4SDimitry Andric #include "clang/Driver/ToolChain.h"
16480093f4SDimitry Andric #include "llvm/Option/ArgList.h"
17480093f4SDimitry Andric #include "llvm/Support/Compiler.h"
18480093f4SDimitry Andric 
19480093f4SDimitry Andric namespace clang {
20480093f4SDimitry Andric namespace driver {
21480093f4SDimitry Andric 
22480093f4SDimitry Andric namespace tools {
23480093f4SDimitry Andric 
24480093f4SDimitry Andric /// Flang compiler tool.
25480093f4SDimitry Andric class LLVM_LIBRARY_VISIBILITY Flang : public Tool {
26e8d8bef9SDimitry Andric private:
27fe6060f1SDimitry Andric   /// Extract fortran dialect options from the driver arguments and add them to
28fe6060f1SDimitry Andric   /// the list of arguments for the generated command/job.
29fe6060f1SDimitry Andric   ///
30fe6060f1SDimitry Andric   /// \param [in] Args The list of input driver arguments
31fe6060f1SDimitry Andric   /// \param [out] CmdArgs The list of output command arguments
32*bdd1243dSDimitry Andric   void addFortranDialectOptions(const llvm::opt::ArgList &Args,
33fe6060f1SDimitry Andric                                 llvm::opt::ArgStringList &CmdArgs) const;
34fe6060f1SDimitry Andric 
35e8d8bef9SDimitry Andric   /// Extract preprocessing options from the driver arguments and add them to
36e8d8bef9SDimitry Andric   /// the preprocessor command arguments.
37e8d8bef9SDimitry Andric   ///
38e8d8bef9SDimitry Andric   /// \param [in] Args The list of input driver arguments
39e8d8bef9SDimitry Andric   /// \param [out] CmdArgs The list of output command arguments
40*bdd1243dSDimitry Andric   void addPreprocessingOptions(const llvm::opt::ArgList &Args,
41e8d8bef9SDimitry Andric                                llvm::opt::ArgStringList &CmdArgs) const;
42*bdd1243dSDimitry Andric 
43*bdd1243dSDimitry Andric   /// Extract PIC options from the driver arguments and add them to
44*bdd1243dSDimitry Andric   /// the command arguments.
45*bdd1243dSDimitry Andric   ///
46*bdd1243dSDimitry Andric   /// \param [in] Args The list of input driver arguments
47*bdd1243dSDimitry Andric   /// \param [out] CmdArgs The list of output command arguments
48*bdd1243dSDimitry Andric   void addPicOptions(const llvm::opt::ArgList &Args,
49*bdd1243dSDimitry Andric                      llvm::opt::ArgStringList &CmdArgs) const;
50*bdd1243dSDimitry Andric 
51*bdd1243dSDimitry Andric   /// Extract target options from the driver arguments and add them to
52*bdd1243dSDimitry Andric   /// the command arguments.
53*bdd1243dSDimitry Andric   ///
54*bdd1243dSDimitry Andric   /// \param [in] Args The list of input driver arguments
55*bdd1243dSDimitry Andric   /// \param [out] CmdArgs The list of output command arguments
56*bdd1243dSDimitry Andric   void addTargetOptions(const llvm::opt::ArgList &Args,
57*bdd1243dSDimitry Andric                         llvm::opt::ArgStringList &CmdArgs) const;
58*bdd1243dSDimitry Andric 
59fe6060f1SDimitry Andric   /// Extract other compilation options from the driver arguments and add them
60fe6060f1SDimitry Andric   /// to the command arguments.
61fe6060f1SDimitry Andric   ///
62fe6060f1SDimitry Andric   /// \param [in] Args The list of input driver arguments
63fe6060f1SDimitry Andric   /// \param [out] CmdArgs The list of output command arguments
64*bdd1243dSDimitry Andric   void addOtherOptions(const llvm::opt::ArgList &Args,
65fe6060f1SDimitry Andric                        llvm::opt::ArgStringList &CmdArgs) const;
66e8d8bef9SDimitry Andric 
67480093f4SDimitry Andric public:
68480093f4SDimitry Andric   Flang(const ToolChain &TC);
69480093f4SDimitry Andric   ~Flang() override;
70480093f4SDimitry Andric 
71480093f4SDimitry Andric   bool hasGoodDiagnostics() const override { return true; }
72480093f4SDimitry Andric   bool hasIntegratedAssembler() const override { return true; }
73480093f4SDimitry Andric   bool hasIntegratedCPP() const override { return true; }
74480093f4SDimitry Andric   bool canEmitIR() const override { return true; }
75480093f4SDimitry Andric 
76480093f4SDimitry Andric   void ConstructJob(Compilation &C, const JobAction &JA,
77480093f4SDimitry Andric                     const InputInfo &Output, const InputInfoList &Inputs,
78480093f4SDimitry Andric                     const llvm::opt::ArgList &TCArgs,
79480093f4SDimitry Andric                     const char *LinkingOutput) const override;
80480093f4SDimitry Andric };
81480093f4SDimitry Andric 
82480093f4SDimitry Andric } // end namespace tools
83480093f4SDimitry Andric 
84480093f4SDimitry Andric } // end namespace driver
85480093f4SDimitry Andric } // end namespace clang
86480093f4SDimitry Andric 
87480093f4SDimitry Andric #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FLANG_H
88