clang 24.0.0git
CommonArgs.h
Go to the documentation of this file.
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
13#include "clang/Driver/Driver.h"
16#include "clang/Driver/Tool.h"
18#include "llvm/ADT/StringRef.h"
19#include "llvm/Option/Arg.h"
20#include "llvm/Option/ArgList.h"
21#include "llvm/Support/CodeGen.h"
22
23namespace clang {
24namespace driver {
25namespace tools {
26
28 enum class Kind { Missing, Invalid, Jobserver, Fixed };
29
31 llvm::opt::Arg *A = nullptr;
32 StringRef Value;
33 unsigned NumThreads = 0;
34
35 bool isValid() const { return K == Kind::Jobserver || K == Kind::Fixed; }
36};
37
38OffloadJobsOpt parseOffloadJobs(const llvm::opt::ArgList &Args);
39
40void addPathIfExists(const Driver &D, const Twine &Path,
42
43void AddLinkerInputs(const ToolChain &TC, const InputInfoList &Inputs,
44 const llvm::opt::ArgList &Args,
45 llvm::opt::ArgStringList &CmdArgs, const JobAction &JA);
46
47const char *getLDMOption(const llvm::Triple &T, const llvm::opt::ArgList &Args);
48
50 const llvm::opt::ArgList &Args,
51 llvm::opt::ArgStringList &CmdArgs);
52
53void renderDebugInfoCompressionArgs(const llvm::opt::ArgList &Args,
54 llvm::opt::ArgStringList &CmdArgs,
55 const Driver &D, const ToolChain &TC);
56
57/// Whether Mach-O objects for \p T with DWARF \p DwarfVersion relocate offsets
58/// between DWARF sections.
59bool useMachORelocatableDwarf(const llvm::Triple &T, unsigned DwarfVersion);
60
61void claimNoWarnArgs(const llvm::opt::ArgList &Args);
62
63bool addSanitizerRuntimes(const ToolChain &TC, const llvm::opt::ArgList &Args,
64 llvm::opt::ArgStringList &CmdArgs, Compilation &C);
65
67 const llvm::opt::ArgList &Args,
68 llvm::opt::ArgStringList &CmdArgs);
69
70bool addXRayRuntime(const ToolChain &TC, const llvm::opt::ArgList &Args,
71 llvm::opt::ArgStringList &CmdArgs);
72
73void linkXRayRuntimeDeps(const ToolChain &TC, const llvm::opt::ArgList &Args,
74 llvm::opt::ArgStringList &CmdArgs);
75
76void AddRunTimeLibs(const ToolChain &TC, const Driver &D,
77 llvm::opt::ArgStringList &CmdArgs,
78 const llvm::opt::ArgList &Args);
79
80const char *SplitDebugName(const JobAction &JA, const llvm::opt::ArgList &Args,
81 const InputInfo &Input, const InputInfo &Output);
82
83void SplitDebugInfo(const ToolChain &TC, Compilation &C, const Tool &T,
84 const JobAction &JA, const llvm::opt::ArgList &Args,
85 const InputInfo &Output, const char *OutFile);
86
87void addDTLTOOptions(const ToolChain &ToolChain, const llvm::opt::ArgList &Args,
88 llvm::opt::ArgStringList &CmdArgs);
89
90void addLTOOptions(const ToolChain &ToolChain, const llvm::opt::ArgList &Args,
91 llvm::opt::ArgStringList &CmdArgs, const InputInfo &Output,
92 const InputInfoList &Inputs, bool IsThinLTO);
93
94const char *RelocationModelName(llvm::Reloc::Model Model);
95
96std::tuple<llvm::Reloc::Model, unsigned, bool>
97ParsePICArgs(const ToolChain &ToolChain, const llvm::opt::ArgList &Args);
98
99bool getStaticPIE(const llvm::opt::ArgList &Args, const ToolChain &TC);
100
102 const llvm::opt::ArgList &Args);
103
104void addDebugInfoKind(llvm::opt::ArgStringList &CmdArgs,
105 llvm::codegenoptions::DebugInfoKind DebugInfoKind);
106
107llvm::codegenoptions::DebugInfoKind
108debugLevelToInfoKind(const llvm::opt::Arg &A);
109
110// Extract the integer N from a string spelled "-dwarf-N", returning 0
111// on mismatch. The StringRef input (rather than an Arg) allows
112// for use by the "-Xassembler" option parser.
113unsigned DwarfVersionNum(StringRef ArgValue);
114// Find a DWARF format version option.
115// This function is a complementary for DwarfVersionNum().
116const llvm::opt::Arg *getDwarfNArg(const llvm::opt::ArgList &Args);
117unsigned getDwarfVersion(const ToolChain &TC, const llvm::opt::ArgList &Args);
118
120
122 const llvm::opt::ArgList &Args,
123 llvm::opt::Arg *&Arg);
124
125bool checkDebugInfoOption(const llvm::opt::Arg *A,
126 const llvm::opt::ArgList &Args, const Driver &D,
127 const ToolChain &TC);
128
130 const llvm::opt::ArgList &Args,
131 llvm::opt::ArgStringList &CmdArgs);
132
134 const llvm::opt::ArgList &Args,
135 llvm::opt::ArgStringList &CmdArgs);
136
137void addArchSpecificRPath(const ToolChain &TC, const llvm::opt::ArgList &Args,
138 llvm::opt::ArgStringList &CmdArgs);
140 const llvm::opt::ArgList &Args,
141 llvm::opt::ArgStringList &CmdArgs);
142
144 llvm::opt::ArgStringList &CmdArgs,
145 const ToolChain &TC,
146 const llvm::opt::ArgList &Args);
147
148/// Returns true, if an OpenMP runtime has been added.
149bool addOpenMPRuntime(const Compilation &C, llvm::opt::ArgStringList &CmdArgs,
150 const ToolChain &TC, const llvm::opt::ArgList &Args,
151 bool ForceStaticHostRuntime = false,
152 bool IsOffloadingHost = false, bool GompNeedsRT = false);
153
154/// Adds offloading options for OpenMP host compilation to \p CmdArgs.
156 const llvm::opt::ArgList &Args,
157 llvm::opt::ArgStringList &CmdArgs);
158
159void addAsNeededOption(const ToolChain &TC, const llvm::opt::ArgList &Args,
160 llvm::opt::ArgStringList &CmdArgs, bool as_needed);
161
162llvm::opt::Arg *getLastCSProfileGenerateArg(const llvm::opt::ArgList &Args);
163llvm::opt::Arg *getLastProfileUseArg(const llvm::opt::ArgList &Args);
164llvm::opt::Arg *getLastProfileSampleUseArg(const llvm::opt::ArgList &Args);
165
166bool isObjCAutoRefCount(const llvm::opt::ArgList &Args);
167
168llvm::StringRef getLTOParallelism(const llvm::opt::ArgList &Args,
169 const Driver &D);
170
171bool areOptimizationsEnabled(const llvm::opt::ArgList &Args);
172
173bool isUseSeparateSections(const llvm::Triple &Triple);
174/// Append -ffunction-sections / -fdata-sections to \p CmdArgs when the
175/// corresponding flags are enabled (explicitly or by target default).
176void addSeparateSectionFlags(const llvm::Triple &Triple,
177 const llvm::opt::ArgList &Args,
178 llvm::opt::ArgStringList &CmdArgs);
179// Parse -mtls-dialect=. Return true if the target supports both general-dynamic
180// and TLSDESC, and TLSDESC is requested.
181bool isTLSDESCEnabled(const ToolChain &TC, const llvm::opt::ArgList &Args);
182
183/// \p EnvVar is split by system delimiter for environment variables.
184/// If \p ArgName is "-I", "-L", or an empty string, each entry from \p EnvVar
185/// is prefixed by \p ArgName then added to \p Args. Otherwise, for each
186/// entry of \p EnvVar, \p ArgName is added to \p Args first, then the entry
187/// itself is added.
188void addDirectoryList(const llvm::opt::ArgList &Args,
189 llvm::opt::ArgStringList &CmdArgs, const char *ArgName,
190 const char *EnvVar);
191
192void AddTargetFeature(const llvm::opt::ArgList &Args,
193 std::vector<StringRef> &Features,
194 llvm::opt::OptSpecifier OnOpt,
195 llvm::opt::OptSpecifier OffOpt, StringRef FeatureName);
196
197std::string getCPUName(const Driver &D, const llvm::opt::ArgList &Args,
198 const llvm::Triple &T, bool FromAs = false);
199
200void getTargetFeatures(const Driver &D, const llvm::Triple &Triple,
201 const llvm::opt::ArgList &Args,
202 llvm::opt::ArgStringList &CmdArgs, bool ForAS,
203 bool IsAux = false);
204
205/// Iterate \p Args and convert -mxxx to +xxx and -mno-xxx to -xxx and
206/// append it to \p Features.
207///
208/// Note: Since \p Features may contain default values before calling
209/// this function, or may be appended with entries to override arguments,
210/// entries in \p Features are not unique.
211void handleTargetFeaturesGroup(const Driver &D, const llvm::Triple &Triple,
212 const llvm::opt::ArgList &Args,
213 std::vector<StringRef> &Features,
214 llvm::opt::OptSpecifier Group);
215
216/// If there are multiple +xxx or -xxx features, keep the last one.
218
219/// Handles the -save-stats option and returns the filename to save statistics
220/// to.
221SmallString<128> getStatsFileName(const llvm::opt::ArgList &Args,
222 const InputInfo &Output,
223 const InputInfo &Input, const Driver &D);
224
225/// \p Flag must be a flag accepted by the driver.
226void addMultilibFlag(bool Enabled, const StringRef Flag,
227 Multilib::flags_list &Flags);
228
229void addX86AlignBranchArgs(const Driver &D, const llvm::opt::ArgList &Args,
230 llvm::opt::ArgStringList &CmdArgs, bool IsLTO,
231 const StringRef PluginOptPrefix = "");
232
234 const llvm::opt::ArgList &Args);
235
236unsigned getAMDGPUCodeObjectVersion(const Driver &D,
237 const llvm::opt::ArgList &Args);
238
240 const llvm::opt::ArgList &Args);
241
242void addMachineOutlinerArgs(const Driver &D, const llvm::opt::ArgList &Args,
243 llvm::opt::ArgStringList &CmdArgs,
244 const llvm::Triple &Triple, bool IsLTO,
245 const StringRef PluginOptPrefix = "");
246
248 const llvm::opt::ArgList &Args,
249 llvm::opt::ArgStringList &CmdArgs,
250 const llvm::Triple &Triple);
251
252void addOpenMPDeviceRTL(const Driver &D, const llvm::opt::ArgList &DriverArgs,
253 llvm::opt::ArgStringList &CC1Args,
254 StringRef BitcodeSuffix, const llvm::Triple &Triple,
255 const ToolChain &HostTC);
256
257/// Try to link libclc, depending on the target ABI and command line
258/// arguments.
259///
260/// \return true if libclc should be linked for the compile.
261bool addOpenCLBuiltinsLib(const Driver &D, const llvm::Triple &TT,
262 const llvm::opt::ArgList &DriverArgs,
263 llvm::opt::ArgStringList &CC1Args);
264
265void addOutlineAtomicsArgs(const Driver &D, const ToolChain &TC,
266 const llvm::opt::ArgList &Args,
267 llvm::opt::ArgStringList &CmdArgs,
268 const llvm::Triple &Triple);
269void addOffloadCompressArgs(const llvm::opt::ArgList &TCArgs,
270 llvm::opt::ArgStringList &CmdArgs,
271 bool EmitCompressionFormat = false);
272void addMCModel(const Driver &D, const llvm::opt::ArgList &Args,
273 const llvm::Triple &Triple,
274 const llvm::Reloc::Model &RelocationModel,
275 llvm::opt::ArgStringList &CmdArgs);
276
277/// Handle the -f{no}-color-diagnostics and -f{no}-diagnostics-colors options.
278void handleColorDiagnosticsArgs(const Driver &D, const llvm::opt::ArgList &Args,
279 llvm::opt::ArgStringList &CmdArgs);
280
281/// Add backslashes to escape spaces and other backslashes.
282/// This is used for the space-separated argument list specified with
283/// the -dwarf-debug-flags option.
284void escapeSpacesAndBackslashes(const char *Arg,
286
287/// Join the args in the given ArgList, escape spaces and backslashes and
288/// return the joined string. This is used when saving the command line as a
289/// result of using either the -frecord-command-line or -grecord-command-line
290/// options. The lifetime of the returned c-string will match that of the Args
291/// argument.
292const char *renderEscapedCommandLine(const ToolChain &TC,
293 const llvm::opt::ArgList &Args);
294
295/// Check if the command line should be recorded in the object file. This is
296/// done if either -frecord-command-line or -grecord-command-line options have
297/// been passed. This also does some error checking since -frecord-command-line
298/// is currently only supported on ELF platforms. The last two boolean
299/// arguments are out parameters and will be set depending on the command
300/// line options that were passed.
302 const llvm::opt::ArgList &Args,
303 bool &FRecordCommandLine, bool &GRecordCommandLine,
304 bool &DXRecordCommandLine);
305
306void renderGlobalISelOptions(const Driver &D, const llvm::opt::ArgList &Args,
307 llvm::opt::ArgStringList &CmdArgs,
308 const llvm::Triple &Triple);
309
310void renderCommonIntegerOverflowOptions(const llvm::opt::ArgList &Args,
311 llvm::opt::ArgStringList &CmdArgs,
312 bool IsMSVCCompat);
313
314bool shouldEnableVectorizerAtOLevel(const llvm::opt::ArgList &Args,
315 bool isSlpVec);
316
317/// Enable -floop-interchange based on the optimization level selected.
318void handleInterchangeLoopsArgs(const llvm::opt::ArgList &Args,
319 llvm::opt::ArgStringList &CmdArgs);
320
321/// Enable -fvectorize based on the optimization level selected.
322void handleVectorizeLoopsArgs(const llvm::opt::ArgList &Args,
323 llvm::opt::ArgStringList &CmdArgs);
324
325/// Enable -fslp-vectorize based on the optimization level selected.
326void handleVectorizeSLPArgs(const llvm::opt::ArgList &Args,
327 llvm::opt::ArgStringList &CmdArgs);
328
329// Convert ComplexRangeKind to a string that can be passed as a frontend option.
331
332// Render a frontend option corresponding to ComplexRangeKind.
334
335// Set the complex range and output a warning as needed.
336void setComplexRange(const Driver &D, StringRef NewOpt,
337 LangOptions::ComplexRangeKind NewRange, StringRef &LastOpt,
339
340// This function expects that the inputs to llvm-link will be specified by the
341// caller, but the output is handled by this function, with the optional ability
342// to set the output filename.
344 const JobAction &JA,
345 const InputInfoList &JobInputs,
346 const llvm::opt::ArgStringList &LinkerInputs,
347 const InputInfo &Output,
348 const llvm::opt::ArgList &Args,
349 const char *OutputFilename = nullptr);
350
351} // end namespace tools
352} // end namespace driver
353} // end namespace clang
354
356getFramePointerKind(const llvm::opt::ArgList &Args, const llvm::Triple &Triple);
357
358#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_COMMONARGS_H
clang::CodeGenOptions::FramePointerKind getFramePointerKind(const llvm::opt::ArgList &Args, const llvm::Triple &Triple)
ComplexRangeKind
Controls the various implementations for complex multiplication and.
Compilation - A set of tasks to perform for a single driver invocation.
Definition Compilation.h:47
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition Driver.h:93
InputInfo - Wrapper for information about an input source.
Definition InputInfo.h:22
std::vector< std::string > flags_list
Definition Multilib.h:37
ToolChain - Access to tools for a single platform.
Definition ToolChain.h:92
SmallVector< std::string, 16 > path_list
Definition ToolChain.h:94
Tool - Information on a specific compilation tool.
Definition Tool.h:31
void addX86AlignBranchArgs(const Driver &D, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, bool IsLTO, const StringRef PluginOptPrefix="")
void addMachineOutlinerArgs(const Driver &D, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const llvm::Triple &Triple, bool IsLTO, const StringRef PluginOptPrefix="")
unsigned ParseFunctionAlignment(const ToolChain &TC, const llvm::opt::ArgList &Args)
void handleTargetFeaturesGroup(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args, std::vector< StringRef > &Features, llvm::opt::OptSpecifier Group)
Iterate Args and convert -mxxx to +xxx and -mno-xxx to -xxx and append it to Features.
void addMCModel(const Driver &D, const llvm::opt::ArgList &Args, const llvm::Triple &Triple, const llvm::Reloc::Model &RelocationModel, llvm::opt::ArgStringList &CmdArgs)
SmallVector< StringRef > unifyTargetFeatures(ArrayRef< StringRef > Features)
If there are multiple +xxx or -xxx features, keep the last one.
llvm::opt::Arg * getLastProfileSampleUseArg(const llvm::opt::ArgList &Args)
void handleVectorizeSLPArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
Enable -fslp-vectorize based on the optimization level selected.
void addOpenMPDeviceRTL(const Driver &D, const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, StringRef BitcodeSuffix, const llvm::Triple &Triple, const ToolChain &HostTC)
OffloadJobsOpt parseOffloadJobs(const llvm::opt::ArgList &Args)
const char * SplitDebugName(const JobAction &JA, const llvm::opt::ArgList &Args, const InputInfo &Input, const InputInfo &Output)
void addOutlineAtomicsArgs(const Driver &D, const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const llvm::Triple &Triple)
void checkAMDGPUCodeObjectVersion(const Driver &D, const llvm::opt::ArgList &Args)
void getTargetFeatures(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, bool ForAS, bool IsAux=false)
void addOffloadCompressArgs(const llvm::opt::ArgList &TCArgs, llvm::opt::ArgStringList &CmdArgs, bool EmitCompressionFormat=false)
void renderDebugInfoCompressionArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const Driver &D, const ToolChain &TC)
std::string complexRangeKindToStr(LangOptions::ComplexRangeKind Range)
void addAsNeededOption(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, bool as_needed)
bool addSanitizerRuntimes(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, Compilation &C)
void handleColorDiagnosticsArgs(const Driver &D, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
Handle the -f{no}-color-diagnostics and -f{no}-diagnostics-colors options.
bool getStaticPIE(const llvm::opt::ArgList &Args, const ToolChain &TC)
std::string getCPUName(const Driver &D, const llvm::opt::ArgList &Args, const llvm::Triple &T, bool FromAs=false)
bool useMachORelocatableDwarf(const llvm::Triple &T, unsigned DwarfVersion)
Whether Mach-O objects for T with DWARF DwarfVersion relocate offsets between DWARF sections.
void addLTOOptions(const ToolChain &ToolChain, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const InputInfo &Output, const InputInfoList &Inputs, bool IsThinLTO)
void addMultilibFlag(bool Enabled, const StringRef Flag, Multilib::flags_list &Flags)
Flag must be a flag accepted by the driver.
bool isUseSeparateSections(const llvm::Triple &Triple)
void linkXRayRuntimeDeps(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
void AddRunTimeLibs(const ToolChain &TC, const Driver &D, llvm::opt::ArgStringList &CmdArgs, const llvm::opt::ArgList &Args)
void SplitDebugInfo(const ToolChain &TC, Compilation &C, const Tool &T, const JobAction &JA, const llvm::opt::ArgList &Args, const InputInfo &Output, const char *OutFile)
void linkSanitizerRuntimeDeps(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
void addDirectoryList(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const char *ArgName, const char *EnvVar)
EnvVar is split by system delimiter for environment variables.
bool addLLVMOffloadingRuntime(const Compilation &C, llvm::opt::ArgStringList &CmdArgs, const ToolChain &TC, const llvm::opt::ArgList &Args)
bool areOptimizationsEnabled(const llvm::opt::ArgList &Args)
void addOpenMPRuntimeLibraryPath(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
void setComplexRange(const Driver &D, StringRef NewOpt, LangOptions::ComplexRangeKind NewRange, StringRef &LastOpt, LangOptions::ComplexRangeKind &Range)
bool addXRayRuntime(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
void AddAssemblerKPIC(const ToolChain &ToolChain, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
bool haveAMDGPUCodeObjectVersionArgument(const Driver &D, const llvm::opt::ArgList &Args)
bool isTLSDESCEnabled(const ToolChain &TC, const llvm::opt::ArgList &Args)
void addDebugInfoForProfilingArgs(const Driver &D, const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
void addDebugInfoKind(llvm::opt::ArgStringList &CmdArgs, llvm::codegenoptions::DebugInfoKind DebugInfoKind)
void addPathIfExists(const Driver &D, const Twine &Path, ToolChain::path_list &Paths)
llvm::codegenoptions::DebugInfoKind debugLevelToInfoKind(const llvm::opt::Arg &A)
llvm::opt::Arg * getLastCSProfileGenerateArg(const llvm::opt::ArgList &Args)
void renderGlobalISelOptions(const Driver &D, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const llvm::Triple &Triple)
llvm::opt::Arg * getLastProfileUseArg(const llvm::opt::ArgList &Args)
void addDTLTOOptions(const ToolChain &ToolChain, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
std::string renderComplexRangeOption(LangOptions::ComplexRangeKind Range)
DwarfFissionKind getDebugFissionKind(const Driver &D, const llvm::opt::ArgList &Args, llvm::opt::Arg *&Arg)
llvm::StringRef getLTOParallelism(const llvm::opt::ArgList &Args, const Driver &D)
void addLinkerCompressDebugSectionsOption(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
void constructLLVMLinkCommand(Compilation &C, const Tool &T, const JobAction &JA, const InputInfoList &JobInputs, const llvm::opt::ArgStringList &LinkerInputs, const InputInfo &Output, const llvm::opt::ArgList &Args, const char *OutputFilename=nullptr)
void handleInterchangeLoopsArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
Enable -floop-interchange based on the optimization level selected.
const char * renderEscapedCommandLine(const ToolChain &TC, const llvm::opt::ArgList &Args)
Join the args in the given ArgList, escape spaces and backslashes and return the joined string.
void renderCommonIntegerOverflowOptions(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, bool IsMSVCCompat)
void addSplitMachineFunctionsArgs(const Driver &D, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const llvm::Triple &Triple)
bool addOpenMPRuntime(const Compilation &C, llvm::opt::ArgStringList &CmdArgs, const ToolChain &TC, const llvm::opt::ArgList &Args, bool ForceStaticHostRuntime=false, bool IsOffloadingHost=false, bool GompNeedsRT=false)
Returns true, if an OpenMP runtime has been added.
bool checkDebugInfoOption(const llvm::opt::Arg *A, const llvm::opt::ArgList &Args, const Driver &D, const ToolChain &TC)
std::tuple< llvm::Reloc::Model, unsigned, bool > ParsePICArgs(const ToolChain &ToolChain, const llvm::opt::ArgList &Args)
void claimNoWarnArgs(const llvm::opt::ArgList &Args)
unsigned DwarfVersionNum(StringRef ArgValue)
void AddLinkerInputs(const ToolChain &TC, const InputInfoList &Inputs, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const JobAction &JA)
unsigned getDwarfVersion(const ToolChain &TC, const llvm::opt::ArgList &Args)
bool shouldRecordCommandLine(const ToolChain &TC, const llvm::opt::ArgList &Args, bool &FRecordCommandLine, bool &GRecordCommandLine, bool &DXRecordCommandLine)
Check if the command line should be recorded in the object file.
unsigned getAMDGPUCodeObjectVersion(const Driver &D, const llvm::opt::ArgList &Args)
const llvm::opt::Arg * getDwarfNArg(const llvm::opt::ArgList &Args)
void AddTargetFeature(const llvm::opt::ArgList &Args, std::vector< StringRef > &Features, llvm::opt::OptSpecifier OnOpt, llvm::opt::OptSpecifier OffOpt, StringRef FeatureName)
SmallString< 128 > getStatsFileName(const llvm::opt::ArgList &Args, const InputInfo &Output, const InputInfo &Input, const Driver &D)
Handles the -save-stats option and returns the filename to save statistics to.
void addArchSpecificRPath(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
void addSeparateSectionFlags(const llvm::Triple &Triple, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
Append -ffunction-sections / -fdata-sections to CmdArgs when the corresponding flags are enabled (exp...
void handleVectorizeLoopsArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
Enable -fvectorize based on the optimization level selected.
void escapeSpacesAndBackslashes(const char *Arg, llvm::SmallVectorImpl< char > &Res)
Add backslashes to escape spaces and other backslashes.
bool addOpenCLBuiltinsLib(const Driver &D, const llvm::Triple &TT, const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args)
Try to link libclc, depending on the target ABI and command line arguments.
const char * getLDMOption(const llvm::Triple &T, const llvm::opt::ArgList &Args)
bool isObjCAutoRefCount(const llvm::opt::ArgList &Args)
const char * RelocationModelName(llvm::Reloc::Model Model)
void addOpenMPHostOffloadingArgs(const Compilation &C, const JobAction &JA, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
Adds offloading options for OpenMP host compilation to CmdArgs.
bool shouldEnableVectorizerAtOLevel(const llvm::opt::ArgList &Args, bool isSlpVec)
SmallVector< InputInfo, 4 > InputInfoList
Definition Driver.h:49
Top level wrappers for InstallAPI frontend operations.
const FunctionProtoType * T