9#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_GNU_H
10#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_GNU_H
35 StringRef
Path,
const llvm::opt::ArgList &Args,
50 const llvm::opt::ArgList &TCArgs,
51 const char *LinkingOutput)
const override;
63 const llvm::opt::ArgList &TCArgs,
64 const char *LinkingOutput)
const override;
70 :
Tool(
"GNU::StaticLibTool",
"static-lib-linker", TC) {}
77 const llvm::opt::ArgList &TCArgs,
78 const char *LinkingOutput)
const override;
95 const llvm::opt::ArgList &TCArgs,
96 const char *LinkingOutput)
const override;
101 llvm::opt::ArgStringList &CmdArgs)
const = 0;
107 :
Common(
"gcc::Preprocessor",
"gcc preprocessor", TC) {}
112 void RenderExtraToolArgs(
const JobAction &JA,
113 llvm::opt::ArgStringList &CmdArgs)
const override;
123 void RenderExtraToolArgs(
const JobAction &JA,
124 llvm::opt::ArgStringList &CmdArgs)
const override;
134 void RenderExtraToolArgs(
const JobAction &JA,
135 llvm::opt::ArgStringList &CmdArgs)
const override;
140namespace toolchains {
175 static GCCVersion Parse(StringRef VersionText);
176 bool isOlderThan(
int RHSMajor,
int RHSMinor,
int RHSPatch,
177 StringRef RHSPatchSuffix = StringRef())
const;
194 llvm::Triple GCCTriple;
198 std::string GCCInstallPath;
199 std::string GCCParentLibPath;
205 std::optional<Multilib> BiarchSibling;
211 std::set<std::string> CandidateGCCInstallPaths;
217 const std::string GentooConfigDir =
"/etc/env.d/gcc";
221 void init(
const llvm::Triple &TargetTriple,
const llvm::opt::ArgList &Args);
227 const llvm::Triple &
getTriple()
const {
return GCCTriple; }
243 bool getBiarchSibling(
Multilib &M)
const;
249 void print(raw_ostream &OS)
const;
253 CollectLibDirsAndTriples(
const llvm::Triple &TargetTriple,
254 const llvm::Triple &BiarchTriple,
260 void AddDefaultGCCPrefixes(
const llvm::Triple &TargetTriple,
264 bool ScanGCCForMultilibs(
const llvm::Triple &TargetTriple,
265 const llvm::opt::ArgList &Args,
267 bool NeedsBiarchSuffix =
false);
269 void ScanLibDirForGCCTriple(
const llvm::Triple &TargetArch,
270 const llvm::opt::ArgList &Args,
271 const std::string &LibDir,
272 StringRef CandidateTriple,
273 bool NeedsBiarchSuffix,
bool GCCDirExists,
274 bool GCCCrossDirExists);
276 bool ScanGentooConfigs(
const llvm::Triple &TargetTriple,
277 const llvm::opt::ArgList &Args,
281 bool ScanGentooGccConfig(
const llvm::Triple &TargetTriple,
282 const llvm::opt::ArgList &Args,
283 StringRef CandidateTriple,
284 bool NeedsBiarchSuffix =
false);
294 const llvm::opt::ArgList &Args);
297 void printVerboseInfo(raw_ostream &OS)
const override;
300 getDefaultUnwindTableLevel(
const llvm::opt::ArgList &Args)
const override;
301 bool isPICDefault()
const override;
302 bool isPIEDefault(
const llvm::opt::ArgList &Args)
const override;
303 bool isPICDefaultForced()
const override;
304 bool IsIntegratedAssemblerDefault()
const override;
305 llvm::opt::DerivedArgList *
306 TranslateArgs(
const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
311 Tool *buildAssembler()
const override;
312 Tool *buildLinker()
const override;
324 void AddMultilibPaths(
const Driver &
D,
const std::string &SysRoot,
325 const std::string &OSLibDir,
326 const std::string &MultiarchTriple,
328 void AddMultiarchPaths(
const Driver &
D,
const std::string &SysRoot,
329 const std::string &OSLibDir, path_list &Paths);
330 void AddMultilibIncludeArgs(
const llvm::opt::ArgList &DriverArgs,
331 llvm::opt::ArgStringList &CC1Args)
const;
335 void AddClangCXXStdlibIncludeArgs(
336 const llvm::opt::ArgList &DriverArgs,
337 llvm::opt::ArgStringList &CC1Args)
const override;
340 addLibCxxIncludePaths(
const llvm::opt::ArgList &DriverArgs,
341 llvm::opt::ArgStringList &CC1Args)
const;
343 addLibStdCxxIncludePaths(
const llvm::opt::ArgList &DriverArgs,
344 llvm::opt::ArgStringList &CC1Args)
const;
346 bool addGCCLibStdCxxIncludePaths(
const llvm::opt::ArgList &DriverArgs,
347 llvm::opt::ArgStringList &CC1Args,
348 StringRef DebianMultiarch)
const;
350 bool addLibStdCXXIncludePaths(Twine IncludeDir, StringRef Triple,
352 const llvm::opt::ArgList &DriverArgs,
353 llvm::opt::ArgStringList &CC1Args,
354 bool DetectDebian =
false)
const;
359 mutable std::unique_ptr<tools::gcc::Preprocessor> Preprocess;
360 mutable std::unique_ptr<tools::gcc::Compiler> Compile;
364 virtual void anchor();
368 const llvm::opt::ArgList &Args)
371 void addClangTargetOptions(
const llvm::opt::ArgList &DriverArgs,
372 llvm::opt::ArgStringList &CC1Args,
static void print(llvm::raw_ostream &OS, const T &V, ASTContext &ASTCtx, QualType Ty)
Simple wrapper for toolchain detector with costly initialization.
Compilation - A set of tasks to perform for a single driver invocation.
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
See also MultilibSetBuilder for combining multilibs into a set.
This corresponds to a single GCC Multilib, or a segment of one controlled by a command line flag.
bool findMIPSMultilibs(const Driver &D, const llvm::Triple &TargetTriple, StringRef Path, const llvm::opt::ArgList &Args, DetectedMultilibs &Result)
The JSON file list parser is used to communicate input to InstallAPI.
@ Result
The result type of a method or function.
MultilibSet Multilibs
The set of multilibs that the detected installation supports.
std::optional< Multilib > BiarchSibling
On Biarch systems, this corresponds to the default multilib when targeting the non-default multilib.
llvm::SmallVector< Multilib > SelectedMultilibs
The multilibs appropriate for the given flags.