]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/clang/lib/Driver/ToolChains/CommonArgs.h
Merge ^/vendor/clang/dist up to its last change, and resolve conflicts.
[FreeBSD/FreeBSD.git] / contrib / llvm-project / clang / lib / Driver / ToolChains / CommonArgs.h
1 //===--- CommonArgs.h - Args handling for multiple toolchains ---*- 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_COMMONARGS_H
10 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_COMMONARGS_H
11
12 #include "InputInfo.h"
13 #include "clang/Driver/Driver.h"
14 #include "clang/Driver/Multilib.h"
15 #include "clang/Driver/Tool.h"
16 #include "clang/Driver/ToolChain.h"
17 #include "llvm/Support/CodeGen.h"
18
19 namespace clang {
20 namespace driver {
21 namespace tools {
22
23 void addPathIfExists(const Driver &D, const Twine &Path,
24                      ToolChain::path_list &Paths);
25
26 void AddLinkerInputs(const ToolChain &TC, const InputInfoList &Inputs,
27                      const llvm::opt::ArgList &Args,
28                      llvm::opt::ArgStringList &CmdArgs, const JobAction &JA);
29
30 void claimNoWarnArgs(const llvm::opt::ArgList &Args);
31
32 bool addSanitizerRuntimes(const ToolChain &TC, const llvm::opt::ArgList &Args,
33                           llvm::opt::ArgStringList &CmdArgs);
34
35 void linkSanitizerRuntimeDeps(const ToolChain &TC,
36                               llvm::opt::ArgStringList &CmdArgs);
37
38 bool addXRayRuntime(const ToolChain &TC, const llvm::opt::ArgList &Args,
39                     llvm::opt::ArgStringList &CmdArgs);
40
41 void linkXRayRuntimeDeps(const ToolChain &TC,
42                          llvm::opt::ArgStringList &CmdArgs);
43
44 void AddRunTimeLibs(const ToolChain &TC, const Driver &D,
45                     llvm::opt::ArgStringList &CmdArgs,
46                     const llvm::opt::ArgList &Args);
47
48 void AddHIPLinkerScript(const ToolChain &TC, Compilation &C,
49                         const InputInfo &Output, const InputInfoList &Inputs,
50                         const llvm::opt::ArgList &Args,
51                         llvm::opt::ArgStringList &CmdArgs, const JobAction &JA,
52                         const Tool &T);
53
54 const char *SplitDebugName(const llvm::opt::ArgList &Args,
55                            const InputInfo &Input, const InputInfo &Output);
56
57 void SplitDebugInfo(const ToolChain &TC, Compilation &C, const Tool &T,
58                     const JobAction &JA, const llvm::opt::ArgList &Args,
59                     const InputInfo &Output, const char *OutFile);
60
61 void AddGoldPlugin(const ToolChain &ToolChain, const llvm::opt::ArgList &Args,
62                    llvm::opt::ArgStringList &CmdArgs, const InputInfo &Output,
63                    const InputInfo &Input, bool IsThinLTO);
64
65 std::tuple<llvm::Reloc::Model, unsigned, bool>
66 ParsePICArgs(const ToolChain &ToolChain, const llvm::opt::ArgList &Args);
67
68 unsigned ParseFunctionAlignment(const ToolChain &TC,
69                                 const llvm::opt::ArgList &Args);
70
71 void AddAssemblerKPIC(const ToolChain &ToolChain,
72                       const llvm::opt::ArgList &Args,
73                       llvm::opt::ArgStringList &CmdArgs);
74
75 void addArchSpecificRPath(const ToolChain &TC, const llvm::opt::ArgList &Args,
76                           llvm::opt::ArgStringList &CmdArgs);
77 /// Returns true, if an OpenMP runtime has been added.
78 bool addOpenMPRuntime(llvm::opt::ArgStringList &CmdArgs, const ToolChain &TC,
79                       const llvm::opt::ArgList &Args,
80                       bool ForceStaticHostRuntime = false,
81                       bool IsOffloadingHost = false, bool GompNeedsRT = false);
82
83 llvm::opt::Arg *getLastProfileUseArg(const llvm::opt::ArgList &Args);
84 llvm::opt::Arg *getLastProfileSampleUseArg(const llvm::opt::ArgList &Args);
85
86 bool isObjCAutoRefCount(const llvm::opt::ArgList &Args);
87
88 unsigned getLTOParallelism(const llvm::opt::ArgList &Args, const Driver &D);
89
90 bool areOptimizationsEnabled(const llvm::opt::ArgList &Args);
91
92 bool isUseSeparateSections(const llvm::Triple &Triple);
93
94 void addDirectoryList(const llvm::opt::ArgList &Args,
95                       llvm::opt::ArgStringList &CmdArgs, const char *ArgName,
96                       const char *EnvVar);
97
98 void AddTargetFeature(const llvm::opt::ArgList &Args,
99                       std::vector<StringRef> &Features,
100                       llvm::opt::OptSpecifier OnOpt,
101                       llvm::opt::OptSpecifier OffOpt, StringRef FeatureName);
102
103 std::string getCPUName(const llvm::opt::ArgList &Args, const llvm::Triple &T,
104                        bool FromAs = false);
105
106 void handleTargetFeaturesGroup(const llvm::opt::ArgList &Args,
107                                std::vector<StringRef> &Features,
108                                llvm::opt::OptSpecifier Group);
109
110 /// Handles the -save-stats option and returns the filename to save statistics
111 /// to.
112 SmallString<128> getStatsFileName(const llvm::opt::ArgList &Args,
113                                   const InputInfo &Output,
114                                   const InputInfo &Input, const Driver &D);
115
116 /// \p Flag must be a flag accepted by the driver with its leading '-' removed,
117 //     otherwise '-print-multi-lib' will not emit them correctly.
118 void addMultilibFlag(bool Enabled, const char *const Flag,
119                      Multilib::flags_list &Flags);
120
121 StringRef getTargetABI(const llvm::opt::ArgList &Args,
122                        const llvm::Triple &Triple);
123
124 void getTargetFeatures(const ToolChain &TC, const llvm::Triple &Triple,
125                        const llvm::opt::ArgList &Args,
126                        llvm::opt::ArgStringList &CmdArgs, bool ForAS,
127                        bool ForLTOPlugin = false);
128
129 } // end namespace tools
130 } // end namespace driver
131 } // end namespace clang
132
133 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_COMMONARGS_H