clang 17.0.0git
Flang.h
Go to the documentation of this file.
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
9#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FLANG_H
10#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FLANG_H
11
12#include "clang/Driver/Tool.h"
13#include "clang/Driver/Action.h"
16#include "llvm/Option/ArgList.h"
17#include "llvm/Support/Compiler.h"
18
19namespace clang {
20namespace driver {
21
22namespace tools {
23
24/// Flang compiler tool.
25class LLVM_LIBRARY_VISIBILITY Flang : public Tool {
26private:
27 /// Extract fortran dialect options from the driver arguments and add them to
28 /// the list of arguments for the generated command/job.
29 ///
30 /// \param [in] Args The list of input driver arguments
31 /// \param [out] CmdArgs The list of output command arguments
32 void addFortranDialectOptions(const llvm::opt::ArgList &Args,
33 llvm::opt::ArgStringList &CmdArgs) const;
34
35 /// Extract preprocessing options from the driver arguments and add them to
36 /// the preprocessor command arguments.
37 ///
38 /// \param [in] Args The list of input driver arguments
39 /// \param [out] CmdArgs The list of output command arguments
40 void addPreprocessingOptions(const llvm::opt::ArgList &Args,
41 llvm::opt::ArgStringList &CmdArgs) const;
42
43 /// Extract PIC 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 addPicOptions(const llvm::opt::ArgList &Args,
49 llvm::opt::ArgStringList &CmdArgs) const;
50
51 /// Extract target options from the driver arguments and add them to
52 /// the command arguments.
53 ///
54 /// \param [in] Args The list of input driver arguments
55 /// \param [out] CmdArgs The list of output command arguments
56 void addTargetOptions(const llvm::opt::ArgList &Args,
57 llvm::opt::ArgStringList &CmdArgs) const;
58
59 /// Extract offload options from the driver arguments and add them to
60 /// the command arguments.
61 /// \param [in] C The current compilation for the driver invocation
62 /// \param [in] Inputs The input infomration on the current file inputs
63 /// \param [in] JA The job action
64 /// \param [in] Args The list of input driver arguments
65 /// \param [out] CmdArgs The list of output command arguments
66 void addOffloadOptions(Compilation &C, const InputInfoList &Inputs,
67 const JobAction &JA, const llvm::opt::ArgList &Args,
68 llvm::opt::ArgStringList &CmdArgs) const;
69
70 /// Extract options for code generation from the driver arguments and add them
71 /// to the command arguments.
72 ///
73 /// \param [in] Args The list of input driver arguments
74 /// \param [out] CmdArgs The list of output command arguments
75 void addCodegenOptions(const llvm::opt::ArgList &Args,
76 llvm::opt::ArgStringList &CmdArgs) const;
77
78 /// Extract other compilation options from the driver arguments and add them
79 /// to the command arguments.
80 ///
81 /// \param [in] Args The list of input driver arguments
82 /// \param [out] CmdArgs The list of output command arguments
83 void addOtherOptions(const llvm::opt::ArgList &Args,
84 llvm::opt::ArgStringList &CmdArgs) const;
85
86public:
87 Flang(const ToolChain &TC);
88 ~Flang() override;
89
90 bool hasGoodDiagnostics() const override { return true; }
91 bool hasIntegratedAssembler() const override { return true; }
92 bool hasIntegratedCPP() const override { return true; }
93 bool canEmitIR() const override { return true; }
94
95 void ConstructJob(Compilation &C, const JobAction &JA,
96 const InputInfo &Output, const InputInfoList &Inputs,
97 const llvm::opt::ArgList &TCArgs,
98 const char *LinkingOutput) const override;
99};
100
101} // end namespace tools
102
103} // end namespace driver
104} // end namespace clang
105
106#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FLANG_H
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:45
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:91
Tool - Information on a specific compilation tool.
Definition: Tool.h:32
Flang compiler tool.
Definition: Flang.h:25
bool canEmitIR() const override
Definition: Flang.h:93
bool hasGoodDiagnostics() const override
Does this tool have "good" standardized diagnostics, or should the driver add an additional "command ...
Definition: Flang.h:90
bool hasIntegratedAssembler() const override
Definition: Flang.h:91
bool hasIntegratedCPP() const override
Definition: Flang.h:92