xref: /freebsd/contrib/llvm-project/clang/lib/Driver/ToolChains/Flang.h (revision fe6060f10f634930ff71b7c50291ddc610da2475)
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:
27*fe6060f1SDimitry Andric   /// Extract fortran dialect options from the driver arguments and add them to
28*fe6060f1SDimitry Andric   /// the list of arguments for the generated command/job.
29*fe6060f1SDimitry Andric   ///
30*fe6060f1SDimitry Andric   /// \param [in] Args The list of input driver arguments
31*fe6060f1SDimitry Andric   /// \param [out] CmdArgs The list of output command arguments
32*fe6060f1SDimitry Andric   void AddFortranDialectOptions(const llvm::opt::ArgList &Args,
33*fe6060f1SDimitry Andric                                 llvm::opt::ArgStringList &CmdArgs) const;
34*fe6060f1SDimitry 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
40e8d8bef9SDimitry Andric   void AddPreprocessingOptions(const llvm::opt::ArgList &Args,
41e8d8bef9SDimitry Andric                                llvm::opt::ArgStringList &CmdArgs) const;
42*fe6060f1SDimitry Andric   /// Extract other compilation options from the driver arguments and add them
43*fe6060f1SDimitry Andric   /// to the command arguments.
44*fe6060f1SDimitry Andric   ///
45*fe6060f1SDimitry Andric   /// \param [in] Args The list of input driver arguments
46*fe6060f1SDimitry Andric   /// \param [out] CmdArgs The list of output command arguments
47*fe6060f1SDimitry Andric   void AddOtherOptions(const llvm::opt::ArgList &Args,
48*fe6060f1SDimitry Andric                        llvm::opt::ArgStringList &CmdArgs) const;
49e8d8bef9SDimitry Andric 
50480093f4SDimitry Andric public:
51480093f4SDimitry Andric   Flang(const ToolChain &TC);
52480093f4SDimitry Andric   ~Flang() override;
53480093f4SDimitry Andric 
54480093f4SDimitry Andric   bool hasGoodDiagnostics() const override { return true; }
55480093f4SDimitry Andric   bool hasIntegratedAssembler() const override { return true; }
56480093f4SDimitry Andric   bool hasIntegratedCPP() const override { return true; }
57480093f4SDimitry Andric   bool canEmitIR() const override { return true; }
58480093f4SDimitry Andric 
59480093f4SDimitry Andric   void ConstructJob(Compilation &C, const JobAction &JA,
60480093f4SDimitry Andric                     const InputInfo &Output, const InputInfoList &Inputs,
61480093f4SDimitry Andric                     const llvm::opt::ArgList &TCArgs,
62480093f4SDimitry Andric                     const char *LinkingOutput) const override;
63480093f4SDimitry Andric };
64480093f4SDimitry Andric 
65480093f4SDimitry Andric } // end namespace tools
66480093f4SDimitry Andric 
67480093f4SDimitry Andric } // end namespace driver
68480093f4SDimitry Andric } // end namespace clang
69480093f4SDimitry Andric 
70480093f4SDimitry Andric #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FLANG_H
71