clang 17.0.0git
ToolChain.h
Go to the documentation of this file.
1//===- ToolChain.h - Collections of tools for one platform ------*- 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_DRIVER_TOOLCHAIN_H
10#define LLVM_CLANG_DRIVER_TOOLCHAIN_H
11
12#include "clang/Basic/LLVM.h"
15#include "clang/Driver/Action.h"
17#include "clang/Driver/Types.h"
18#include "llvm/ADT/APFloat.h"
19#include "llvm/ADT/ArrayRef.h"
20#include "llvm/ADT/FloatingPointMode.h"
21#include "llvm/ADT/SmallVector.h"
22#include "llvm/ADT/StringRef.h"
23#include "llvm/Frontend/Debug/Options.h"
24#include "llvm/MC/MCTargetOptions.h"
25#include "llvm/Option/Option.h"
26#include "llvm/Support/VersionTuple.h"
27#include "llvm/Target/TargetOptions.h"
28#include "llvm/TargetParser/Triple.h"
29#include <cassert>
30#include <climits>
31#include <memory>
32#include <string>
33#include <utility>
34
35namespace llvm {
36namespace opt {
37
38class Arg;
39class ArgList;
40class DerivedArgList;
41
42} // namespace opt
43namespace vfs {
44
45class FileSystem;
46
47} // namespace vfs
48} // namespace llvm
49
50namespace clang {
51
52class ObjCRuntime;
53
54namespace driver {
55
56class Driver;
57class InputInfo;
58class SanitizerArgs;
59class Tool;
60class XRayArgs;
61
62/// Helper structure used to pass information extracted from clang executable
63/// name such as `i686-linux-android-g++`.
65 /// Target part of the executable name, as `i686-linux-android`.
66 std::string TargetPrefix;
67
68 /// Driver mode part of the executable name, as `g++`.
69 std::string ModeSuffix;
70
71 /// Corresponding driver mode argument, as '--driver-mode=g++'
72 const char *DriverMode = nullptr;
73
74 /// True if TargetPrefix is recognized as a registered target name.
75 bool TargetIsValid = false;
76
77 ParsedClangName() = default;
78 ParsedClangName(std::string Suffix, const char *Mode)
79 : ModeSuffix(Suffix), DriverMode(Mode) {}
80 ParsedClangName(std::string Target, std::string Suffix, const char *Mode,
81 bool IsRegistered)
82 : TargetPrefix(Target), ModeSuffix(Suffix), DriverMode(Mode),
83 TargetIsValid(IsRegistered) {}
84
85 bool isEmpty() const {
86 return TargetPrefix.empty() && ModeSuffix.empty() && DriverMode == nullptr;
87 }
88};
89
90/// ToolChain - Access to tools for a single platform.
91class ToolChain {
92public:
94
98 };
99
103 };
104
109 };
110
111 enum class UnwindTableLevel {
112 None,
115 };
116
117 enum RTTIMode {
120 };
121
123 std::string Path;
127 };
128
130
131private:
133
134 const Driver &D;
135 llvm::Triple Triple;
136 const llvm::opt::ArgList &Args;
137
138 // We need to initialize CachedRTTIArg before CachedRTTIMode
139 const llvm::opt::Arg *const CachedRTTIArg;
140
141 const RTTIMode CachedRTTIMode;
142
143 /// The list of toolchain specific path prefixes to search for libraries.
144 path_list LibraryPaths;
145
146 /// The list of toolchain specific path prefixes to search for files.
147 path_list FilePaths;
148
149 /// The list of toolchain specific path prefixes to search for programs.
150 path_list ProgramPaths;
151
152 mutable std::unique_ptr<Tool> Clang;
153 mutable std::unique_ptr<Tool> Flang;
154 mutable std::unique_ptr<Tool> Assemble;
155 mutable std::unique_ptr<Tool> Link;
156 mutable std::unique_ptr<Tool> StaticLibTool;
157 mutable std::unique_ptr<Tool> IfsMerge;
158 mutable std::unique_ptr<Tool> OffloadBundler;
159 mutable std::unique_ptr<Tool> OffloadPackager;
160 mutable std::unique_ptr<Tool> LinkerWrapper;
161
162 Tool *getClang() const;
163 Tool *getFlang() const;
164 Tool *getAssemble() const;
165 Tool *getLink() const;
166 Tool *getStaticLibTool() const;
167 Tool *getIfsMerge() const;
168 Tool *getClangAs() const;
169 Tool *getOffloadBundler() const;
170 Tool *getOffloadPackager() const;
171 Tool *getLinkerWrapper() const;
172
173 mutable bool SanitizerArgsChecked = false;
174 mutable std::unique_ptr<XRayArgs> XRayArguments;
175
176 /// The effective clang triple for the current Job.
177 mutable llvm::Triple EffectiveTriple;
178
179 /// Set the toolchain's effective clang triple.
180 void setEffectiveTriple(llvm::Triple ET) const {
181 EffectiveTriple = std::move(ET);
182 }
183
184 mutable std::optional<CXXStdlibType> cxxStdlibType;
185 mutable std::optional<RuntimeLibType> runtimeLibType;
186 mutable std::optional<UnwindLibType> unwindLibType;
187
188protected:
191
192 ToolChain(const Driver &D, const llvm::Triple &T,
193 const llvm::opt::ArgList &Args);
194
195 /// Executes the given \p Executable and returns the stdout.
197 executeToolChainProgram(StringRef Executable) const;
198
199 void setTripleEnvironment(llvm::Triple::EnvironmentType Env);
200
201 virtual Tool *buildAssembler() const;
202 virtual Tool *buildLinker() const;
203 virtual Tool *buildStaticLibTool() const;
204 virtual Tool *getTool(Action::ActionClass AC) const;
205
206 virtual std::string buildCompilerRTBasename(const llvm::opt::ArgList &Args,
207 StringRef Component,
209 bool AddArch) const;
210
211 /// \name Utilities for implementing subclasses.
212 ///@{
213 static void addSystemInclude(const llvm::opt::ArgList &DriverArgs,
214 llvm::opt::ArgStringList &CC1Args,
215 const Twine &Path);
216 static void addExternCSystemInclude(const llvm::opt::ArgList &DriverArgs,
217 llvm::opt::ArgStringList &CC1Args,
218 const Twine &Path);
219 static void
220 addExternCSystemIncludeIfExists(const llvm::opt::ArgList &DriverArgs,
221 llvm::opt::ArgStringList &CC1Args,
222 const Twine &Path);
223 static void addSystemIncludes(const llvm::opt::ArgList &DriverArgs,
224 llvm::opt::ArgStringList &CC1Args,
225 ArrayRef<StringRef> Paths);
226
227 static std::string concat(StringRef Path, const Twine &A, const Twine &B = "",
228 const Twine &C = "", const Twine &D = "");
229 ///@}
230
231public:
232 virtual ~ToolChain();
233
234 // Accessors
235
236 const Driver &getDriver() const { return D; }
237 llvm::vfs::FileSystem &getVFS() const;
238 const llvm::Triple &getTriple() const { return Triple; }
239
240 /// Get the toolchain's aux triple, if it has one.
241 ///
242 /// Exactly what the aux triple represents depends on the toolchain, but for
243 /// example when compiling CUDA code for the GPU, the triple might be NVPTX,
244 /// while the aux triple is the host (CPU) toolchain, e.g. x86-linux-gnu.
245 virtual const llvm::Triple *getAuxTriple() const { return nullptr; }
246
247 /// Some toolchains need to modify the file name, for example to replace the
248 /// extension for object files with .cubin for OpenMP offloading to Nvidia
249 /// GPUs.
250 virtual std::string getInputFilename(const InputInfo &Input) const;
251
252 llvm::Triple::ArchType getArch() const { return Triple.getArch(); }
253 StringRef getArchName() const { return Triple.getArchName(); }
254 StringRef getPlatform() const { return Triple.getVendorName(); }
255 StringRef getOS() const { return Triple.getOSName(); }
256
257 /// Provide the default architecture name (as expected by -arch) for
258 /// this toolchain.
259 StringRef getDefaultUniversalArchName() const;
260
261 std::string getTripleString() const {
262 return Triple.getTriple();
263 }
264
265 /// Get the toolchain's effective clang triple.
266 const llvm::Triple &getEffectiveTriple() const {
267 assert(!EffectiveTriple.getTriple().empty() && "No effective triple");
268 return EffectiveTriple;
269 }
270
271 bool hasEffectiveTriple() const {
272 return !EffectiveTriple.getTriple().empty();
273 }
274
275 path_list &getLibraryPaths() { return LibraryPaths; }
276 const path_list &getLibraryPaths() const { return LibraryPaths; }
277
278 path_list &getFilePaths() { return FilePaths; }
279 const path_list &getFilePaths() const { return FilePaths; }
280
281 path_list &getProgramPaths() { return ProgramPaths; }
282 const path_list &getProgramPaths() const { return ProgramPaths; }
283
284 const MultilibSet &getMultilibs() const { return Multilibs; }
285
286 const Multilib &getMultilib() const { return SelectedMultilib; }
287
288 SanitizerArgs getSanitizerArgs(const llvm::opt::ArgList &JobArgs) const;
289
290 const XRayArgs& getXRayArgs() const;
291
292 // Returns the Arg * that explicitly turned on/off rtti, or nullptr.
293 const llvm::opt::Arg *getRTTIArg() const { return CachedRTTIArg; }
294
295 // Returns the RTTIMode for the toolchain with the current arguments.
296 RTTIMode getRTTIMode() const { return CachedRTTIMode; }
297
298 /// Return any implicit target and/or mode flag for an invocation of
299 /// the compiler driver as `ProgName`.
300 ///
301 /// For example, when called with i686-linux-android-g++, the first element
302 /// of the return value will be set to `"i686-linux-android"` and the second
303 /// will be set to "--driver-mode=g++"`.
304 /// It is OK if the target name is not registered. In this case the return
305 /// value contains false in the field TargetIsValid.
306 ///
307 /// \pre `llvm::InitializeAllTargets()` has been called.
308 /// \param ProgName The name the Clang driver was invoked with (from,
309 /// e.g., argv[0]).
310 /// \return A structure of type ParsedClangName that contains the executable
311 /// name parts.
312 static ParsedClangName getTargetAndModeFromProgramName(StringRef ProgName);
313
314 // Tool access.
315
316 /// TranslateArgs - Create a new derived argument list for any argument
317 /// translations this ToolChain may wish to perform, or 0 if no tool chain
318 /// specific translations are needed. If \p DeviceOffloadKind is specified
319 /// the translation specific for that offload kind is performed.
320 ///
321 /// \param BoundArch - The bound architecture name, or 0.
322 /// \param DeviceOffloadKind - The device offload kind used for the
323 /// translation.
324 virtual llvm::opt::DerivedArgList *
325 TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
326 Action::OffloadKind DeviceOffloadKind) const {
327 return nullptr;
328 }
329
330 /// TranslateOpenMPTargetArgs - Create a new derived argument list for
331 /// that contains the OpenMP target specific flags passed via
332 /// -Xopenmp-target -opt=val OR -Xopenmp-target=<triple> -opt=val
333 virtual llvm::opt::DerivedArgList *TranslateOpenMPTargetArgs(
334 const llvm::opt::DerivedArgList &Args, bool SameTripleAsHost,
335 SmallVectorImpl<llvm::opt::Arg *> &AllocatedArgs) const;
336
337 /// Append the argument following \p A to \p DAL assuming \p A is an Xarch
338 /// argument. If \p AllocatedArgs is null pointer, synthesized arguments are
339 /// added to \p DAL, otherwise they are appended to \p AllocatedArgs.
340 virtual void TranslateXarchArgs(
341 const llvm::opt::DerivedArgList &Args, llvm::opt::Arg *&A,
342 llvm::opt::DerivedArgList *DAL,
343 SmallVectorImpl<llvm::opt::Arg *> *AllocatedArgs = nullptr) const;
344
345 /// Translate -Xarch_ arguments. If there are no such arguments, return
346 /// a null pointer, otherwise return a DerivedArgList containing the
347 /// translated arguments.
348 virtual llvm::opt::DerivedArgList *
349 TranslateXarchArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
350 Action::OffloadKind DeviceOffloadKind,
351 SmallVectorImpl<llvm::opt::Arg *> *AllocatedArgs) const;
352
353 /// Choose a tool to use to handle the action \p JA.
354 ///
355 /// This can be overridden when a particular ToolChain needs to use
356 /// a compiler other than Clang.
357 virtual Tool *SelectTool(const JobAction &JA) const;
358
359 // Helper methods
360
361 std::string GetFilePath(const char *Name) const;
362 std::string GetProgramPath(const char *Name) const;
363
364 /// Returns the linker path, respecting the -fuse-ld= argument to determine
365 /// the linker suffix or name.
366 /// If LinkerIsLLD is non-nullptr, it is set to true if the returned linker
367 /// is LLD. If it's set, it can be assumed that the linker is LLD built
368 /// at the same revision as clang, and clang can make assumptions about
369 /// LLD's supported flags, error output, etc.
370 std::string GetLinkerPath(bool *LinkerIsLLD = nullptr) const;
371
372 /// Returns the linker path for emitting a static library.
373 std::string GetStaticLibToolPath() const;
374
375 /// Dispatch to the specific toolchain for verbose printing.
376 ///
377 /// This is used when handling the verbose option to print detailed,
378 /// toolchain-specific information useful for understanding the behavior of
379 /// the driver on a specific platform.
380 virtual void printVerboseInfo(raw_ostream &OS) const {}
381
382 // Platform defaults information
383
384 /// Returns true if the toolchain is targeting a non-native
385 /// architecture.
386 virtual bool isCrossCompiling() const;
387
388 /// HasNativeLTOLinker - Check whether the linker and related tools have
389 /// native LLVM support.
390 virtual bool HasNativeLLVMSupport() const;
391
392 /// LookupTypeForExtension - Return the default language type to use for the
393 /// given extension.
394 virtual types::ID LookupTypeForExtension(StringRef Ext) const;
395
396 /// IsBlocksDefault - Does this tool chain enable -fblocks by default.
397 virtual bool IsBlocksDefault() const { return false; }
398
399 /// IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as
400 /// by default.
401 virtual bool IsIntegratedAssemblerDefault() const { return false; }
402
403 /// IsIntegratedBackendDefault - Does this tool chain enable
404 /// -fintegrated-objemitter by default.
405 virtual bool IsIntegratedBackendDefault() const { return true; }
406
407 /// IsIntegratedBackendSupported - Does this tool chain support
408 /// -fintegrated-objemitter.
409 virtual bool IsIntegratedBackendSupported() const { return true; }
410
411 /// IsNonIntegratedBackendSupported - Does this tool chain support
412 /// -fno-integrated-objemitter.
413 virtual bool IsNonIntegratedBackendSupported() const { return false; }
414
415 /// Check if the toolchain should use the integrated assembler.
416 virtual bool useIntegratedAs() const;
417
418 /// Check if the toolchain should use the integrated backend.
419 virtual bool useIntegratedBackend() const;
420
421 /// Check if the toolchain should use AsmParser to parse inlineAsm when
422 /// integrated assembler is not default.
423 virtual bool parseInlineAsmUsingAsmParser() const { return false; }
424
425 /// IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
426 virtual bool IsMathErrnoDefault() const { return true; }
427
428 /// IsEncodeExtendedBlockSignatureDefault - Does this tool chain enable
429 /// -fencode-extended-block-signature by default.
430 virtual bool IsEncodeExtendedBlockSignatureDefault() const { return false; }
431
432 /// IsObjCNonFragileABIDefault - Does this tool chain set
433 /// -fobjc-nonfragile-abi by default.
434 virtual bool IsObjCNonFragileABIDefault() const { return false; }
435
436 /// UseObjCMixedDispatchDefault - When using non-legacy dispatch, should the
437 /// mixed dispatch method be used?
438 virtual bool UseObjCMixedDispatch() const { return false; }
439
440 /// Check whether to enable x86 relax relocations by default.
441 virtual bool useRelaxRelocations() const;
442
443 /// Check whether use IEEE binary128 as long double format by default.
444 bool defaultToIEEELongDouble() const;
445
446 /// GetDefaultStackProtectorLevel - Get the default stack protector level for
447 /// this tool chain.
449 GetDefaultStackProtectorLevel(bool KernelOrKext) const {
450 return LangOptions::SSPOff;
451 }
452
453 /// Get the default trivial automatic variable initialization.
457 }
458
459 /// GetDefaultLinker - Get the default linker to use.
460 virtual const char *getDefaultLinker() const { return "ld"; }
461
462 /// GetDefaultRuntimeLibType - Get the default runtime library variant to use.
465 }
466
469 }
470
472 return ToolChain::UNW_None;
473 }
474
475 virtual std::string getCompilerRTPath() const;
476
477 virtual std::string getCompilerRT(const llvm::opt::ArgList &Args,
478 StringRef Component,
480
481 const char *
482 getCompilerRTArgString(const llvm::opt::ArgList &Args, StringRef Component,
484
485 std::string getCompilerRTBasename(const llvm::opt::ArgList &Args,
486 StringRef Component,
488
489 // Returns target specific runtime paths.
491
492 // Returns target specific standard library paths.
494
495 // Returns <ResourceDir>/lib/<OSName>/<arch> or <ResourceDir>/lib/<triple>.
496 // This is used by runtimes (such as OpenMP) to find arch-specific libraries.
497 virtual path_list getArchSpecificLibPaths() const;
498
499 // Returns <OSname> part of above.
500 virtual StringRef getOSLibName() const;
501
502 /// needsProfileRT - returns true if instrumentation profile is on.
503 static bool needsProfileRT(const llvm::opt::ArgList &Args);
504
505 /// Returns true if gcov instrumentation (-fprofile-arcs or --coverage) is on.
506 static bool needsGCovInstrumentation(const llvm::opt::ArgList &Args);
507
508 /// How detailed should the unwind tables be by default.
509 virtual UnwindTableLevel
510 getDefaultUnwindTableLevel(const llvm::opt::ArgList &Args) const;
511
512 /// Test whether this toolchain supports outline atomics by default.
513 virtual bool
514 IsAArch64OutlineAtomicsDefault(const llvm::opt::ArgList &Args) const {
515 return false;
516 }
517
518 /// Test whether this toolchain defaults to PIC.
519 virtual bool isPICDefault() const = 0;
520
521 /// Test whether this toolchain defaults to PIE.
522 virtual bool isPIEDefault(const llvm::opt::ArgList &Args) const = 0;
523
524 /// Tests whether this toolchain forces its default for PIC, PIE or
525 /// non-PIC. If this returns true, any PIC related flags should be ignored
526 /// and instead the results of \c isPICDefault() and \c isPIEDefault(const
527 /// llvm::opt::ArgList &Args) are used exclusively.
528 virtual bool isPICDefaultForced() const = 0;
529
530 /// SupportsProfiling - Does this tool chain support -pg.
531 virtual bool SupportsProfiling() const { return true; }
532
533 /// Complain if this tool chain doesn't support Objective-C ARC.
534 virtual void CheckObjCARC() const {}
535
536 /// Get the default debug info format. Typically, this is DWARF.
537 virtual llvm::codegenoptions::DebugInfoFormat getDefaultDebugFormat() const {
538 return llvm::codegenoptions::DIF_DWARF;
539 }
540
541 /// UseDwarfDebugFlags - Embed the compile options to clang into the Dwarf
542 /// compile unit information.
543 virtual bool UseDwarfDebugFlags() const { return false; }
544
545 /// Add an additional -fdebug-prefix-map entry.
546 virtual std::string GetGlobalDebugPathRemapping() const { return {}; }
547
548 // Return the DWARF version to emit, in the absence of arguments
549 // to the contrary.
550 virtual unsigned GetDefaultDwarfVersion() const { return 5; }
551
552 // Some toolchains may have different restrictions on the DWARF version and
553 // may need to adjust it. E.g. NVPTX may need to enforce DWARF2 even when host
554 // compilation uses DWARF5.
555 virtual unsigned getMaxDwarfVersion() const { return UINT_MAX; }
556
557 // True if the driver should assume "-fstandalone-debug"
558 // in the absence of an option specifying otherwise,
559 // provided that debugging was requested in the first place.
560 // i.e. a value of 'true' does not imply that debugging is wanted.
561 virtual bool GetDefaultStandaloneDebug() const { return false; }
562
563 // Return the default debugger "tuning."
564 virtual llvm::DebuggerKind getDefaultDebuggerTuning() const {
565 return llvm::DebuggerKind::GDB;
566 }
567
568 /// Does this toolchain supports given debug info option or not.
569 virtual bool supportsDebugInfoOption(const llvm::opt::Arg *) const {
570 return true;
571 }
572
573 /// Adjust debug information kind considering all passed options.
574 virtual void
575 adjustDebugInfoKind(llvm::codegenoptions::DebugInfoKind &DebugInfoKind,
576 const llvm::opt::ArgList &Args) const {}
577
578 /// GetExceptionModel - Return the tool chain exception model.
579 virtual llvm::ExceptionHandling
580 GetExceptionModel(const llvm::opt::ArgList &Args) const;
581
582 /// SupportsEmbeddedBitcode - Does this tool chain support embedded bitcode.
583 virtual bool SupportsEmbeddedBitcode() const { return false; }
584
585 /// getThreadModel() - Which thread model does this target use?
586 virtual std::string getThreadModel() const { return "posix"; }
587
588 /// isThreadModelSupported() - Does this target support a thread model?
589 virtual bool isThreadModelSupported(const StringRef Model) const;
590
591 /// isBareMetal - Is this a bare metal target.
592 virtual bool isBareMetal() const { return false; }
593
594 virtual std::string getMultiarchTriple(const Driver &D,
595 const llvm::Triple &TargetTriple,
596 StringRef SysRoot) const {
597 return TargetTriple.str();
598 }
599
600 /// ComputeLLVMTriple - Return the LLVM target triple to use, after taking
601 /// command line arguments into account.
602 virtual std::string
603 ComputeLLVMTriple(const llvm::opt::ArgList &Args,
604 types::ID InputType = types::TY_INVALID) const;
605
606 /// ComputeEffectiveClangTriple - Return the Clang triple to use for this
607 /// target, which may take into account the command line arguments. For
608 /// example, on Darwin the -mmacosx-version-min= command line argument (which
609 /// sets the deployment target) determines the version in the triple passed to
610 /// Clang.
611 virtual std::string ComputeEffectiveClangTriple(
612 const llvm::opt::ArgList &Args,
613 types::ID InputType = types::TY_INVALID) const;
614
615 /// getDefaultObjCRuntime - Return the default Objective-C runtime
616 /// for this platform.
617 ///
618 /// FIXME: this really belongs on some sort of DeploymentTarget abstraction
619 virtual ObjCRuntime getDefaultObjCRuntime(bool isNonFragile) const;
620
621 /// hasBlocksRuntime - Given that the user is compiling with
622 /// -fblocks, does this tool chain guarantee the existence of a
623 /// blocks runtime?
624 ///
625 /// FIXME: this really belongs on some sort of DeploymentTarget abstraction
626 virtual bool hasBlocksRuntime() const { return true; }
627
628 /// Return the sysroot, possibly searching for a default sysroot using
629 /// target-specific logic.
630 virtual std::string computeSysRoot() const;
631
632 /// Add the clang cc1 arguments for system include paths.
633 ///
634 /// This routine is responsible for adding the necessary cc1 arguments to
635 /// include headers from standard system header directories.
636 virtual void
637 AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
638 llvm::opt::ArgStringList &CC1Args) const;
639
640 /// Add options that need to be passed to cc1 for this target.
641 virtual void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
642 llvm::opt::ArgStringList &CC1Args,
643 Action::OffloadKind DeviceOffloadKind) const;
644
645 /// Add options that need to be passed to cc1as for this target.
646 virtual void
647 addClangCC1ASTargetOptions(const llvm::opt::ArgList &Args,
648 llvm::opt::ArgStringList &CC1ASArgs) const;
649
650 /// Add warning options that need to be passed to cc1 for this target.
651 virtual void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const;
652
653 // GetRuntimeLibType - Determine the runtime library type to use with the
654 // given compilation arguments.
655 virtual RuntimeLibType
656 GetRuntimeLibType(const llvm::opt::ArgList &Args) const;
657
658 // GetCXXStdlibType - Determine the C++ standard library type to use with the
659 // given compilation arguments.
660 virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const;
661
662 // GetUnwindLibType - Determine the unwind library type to use with the
663 // given compilation arguments.
664 virtual UnwindLibType GetUnwindLibType(const llvm::opt::ArgList &Args) const;
665
666 // Detect the highest available version of libc++ in include path.
667 virtual std::string detectLibcxxVersion(StringRef IncludePath) const;
668
669 /// AddClangCXXStdlibIncludeArgs - Add the clang -cc1 level arguments to set
670 /// the include paths to use for the given C++ standard library type.
671 virtual void
672 AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
673 llvm::opt::ArgStringList &CC1Args) const;
674
675 /// AddClangCXXStdlibIsystemArgs - Add the clang -cc1 level arguments to set
676 /// the specified include paths for the C++ standard library.
677 void AddClangCXXStdlibIsystemArgs(const llvm::opt::ArgList &DriverArgs,
678 llvm::opt::ArgStringList &CC1Args) const;
679
680 /// Returns if the C++ standard library should be linked in.
681 /// Note that e.g. -lm should still be linked even if this returns false.
682 bool ShouldLinkCXXStdlib(const llvm::opt::ArgList &Args) const;
683
684 /// AddCXXStdlibLibArgs - Add the system specific linker arguments to use
685 /// for the given C++ standard library type.
686 virtual void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
687 llvm::opt::ArgStringList &CmdArgs) const;
688
689 /// AddFilePathLibArgs - Add each thing in getFilePaths() as a "-L" option.
690 void AddFilePathLibArgs(const llvm::opt::ArgList &Args,
691 llvm::opt::ArgStringList &CmdArgs) const;
692
693 /// AddCCKextLibArgs - Add the system specific linker arguments to use
694 /// for kernel extensions (Darwin-specific).
695 virtual void AddCCKextLibArgs(const llvm::opt::ArgList &Args,
696 llvm::opt::ArgStringList &CmdArgs) const;
697
698 /// If a runtime library exists that sets global flags for unsafe floating
699 /// point math, return true.
700 ///
701 /// This checks for presence of the -Ofast, -ffast-math or -funsafe-math flags.
702 virtual bool isFastMathRuntimeAvailable(
703 const llvm::opt::ArgList &Args, std::string &Path) const;
704
705 /// AddFastMathRuntimeIfAvailable - If a runtime library exists that sets
706 /// global flags for unsafe floating point math, add it and return true.
707 ///
708 /// This checks for presence of the -Ofast, -ffast-math or -funsafe-math flags.
710 const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const;
711
712 /// getSystemGPUArchs - Use a tool to detect the user's availible GPUs.
714 getSystemGPUArchs(const llvm::opt::ArgList &Args) const;
715
716 /// addProfileRTLibs - When -fprofile-instr-profile is specified, try to pass
717 /// a suitable profile runtime library to the linker.
718 virtual void addProfileRTLibs(const llvm::opt::ArgList &Args,
719 llvm::opt::ArgStringList &CmdArgs) const;
720
721 /// Add arguments to use system-specific CUDA includes.
722 virtual void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs,
723 llvm::opt::ArgStringList &CC1Args) const;
724
725 /// Add arguments to use system-specific HIP includes.
726 virtual void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs,
727 llvm::opt::ArgStringList &CC1Args) const;
728
729 /// Add arguments to use MCU GCC toolchain includes.
730 virtual void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
731 llvm::opt::ArgStringList &CC1Args) const;
732
733 /// On Windows, returns the MSVC compatibility version.
734 virtual VersionTuple computeMSVCVersion(const Driver *D,
735 const llvm::opt::ArgList &Args) const;
736
737 /// Get paths for device libraries.
739 getDeviceLibs(const llvm::opt::ArgList &Args) const;
740
741 /// Add the system specific linker arguments to use
742 /// for the given HIP runtime library type.
743 virtual void AddHIPRuntimeLibArgs(const llvm::opt::ArgList &Args,
744 llvm::opt::ArgStringList &CmdArgs) const {}
745
746 /// Return sanitizers which are available in this toolchain.
748
749 /// Return sanitizers which are enabled by default.
751 return SanitizerMask();
752 }
753
754 /// Returns true when it's possible to split LTO unit to use whole
755 /// program devirtualization and CFI santiizers.
756 virtual bool canSplitThinLTOUnit() const { return true; }
757
758 /// Returns the output denormal handling type in the default floating point
759 /// environment for the given \p FPType if given. Otherwise, the default
760 /// assumed mode for any floating point type.
761 virtual llvm::DenormalMode getDefaultDenormalModeForType(
762 const llvm::opt::ArgList &DriverArgs, const JobAction &JA,
763 const llvm::fltSemantics *FPType = nullptr) const {
764 return llvm::DenormalMode::getIEEE();
765 }
766
767 // We want to expand the shortened versions of the triples passed in to
768 // the values used for the bitcode libraries.
769 static llvm::Triple getOpenMPTriple(StringRef TripleStr) {
770 llvm::Triple TT(TripleStr);
771 if (TT.getVendor() == llvm::Triple::UnknownVendor ||
772 TT.getOS() == llvm::Triple::UnknownOS) {
773 if (TT.getArch() == llvm::Triple::nvptx)
774 return llvm::Triple("nvptx-nvidia-cuda");
775 if (TT.getArch() == llvm::Triple::nvptx64)
776 return llvm::Triple("nvptx64-nvidia-cuda");
777 if (TT.getArch() == llvm::Triple::amdgcn)
778 return llvm::Triple("amdgcn-amd-amdhsa");
779 }
780 return TT;
781 }
782};
783
784/// Set a ToolChain's effective triple. Reset it when the registration object
785/// is destroyed.
787 const ToolChain &TC;
788
789public:
790 RegisterEffectiveTriple(const ToolChain &TC, llvm::Triple T) : TC(TC) {
791 TC.setEffectiveTriple(std::move(T));
792 }
793
794 ~RegisterEffectiveTriple() { TC.setEffectiveTriple(llvm::Triple()); }
795};
796
797} // namespace driver
798
799} // namespace clang
800
801#endif // LLVM_CLANG_DRIVER_TOOLCHAIN_H
const Environment & Env
Definition: HTMLLogger.cpp:170
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::LangOptions interface.
Defines the clang::SanitizerKind enum.
The basic abstraction for the target Objective-C runtime.
Definition: ObjCRuntime.h:28
The base class of the type hierarchy.
Definition: Type.h:1568
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:77
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
See also MultilibSetBuilder for combining multilibs into a set.
Definition: Multilib.h:78
This corresponds to a single GCC Multilib, or a segment of one controlled by a command line flag.
Definition: Multilib.h:30
Set a ToolChain's effective triple.
Definition: ToolChain.h:786
RegisterEffectiveTriple(const ToolChain &TC, llvm::Triple T)
Definition: ToolChain.h:790
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:91
virtual bool isFastMathRuntimeAvailable(const llvm::opt::ArgList &Args, std::string &Path) const
If a runtime library exists that sets global flags for unsafe floating point math,...
Definition: ToolChain.cpp:1119
virtual std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args, types::ID InputType=types::TY_INVALID) const
ComputeEffectiveClangTriple - Return the Clang triple to use for this target, which may take into acc...
Definition: ToolChain.cpp:861
virtual std::string GetGlobalDebugPathRemapping() const
Add an additional -fdebug-prefix-map entry.
Definition: ToolChain.h:546
virtual void AddCCKextLibArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
AddCCKextLibArgs - Add the system specific linker arguments to use for kernel extensions (Darwin-spec...
Definition: ToolChain.cpp:1114
virtual void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const
Add warning options that need to be passed to cc1 for this target.
Definition: ToolChain.cpp:882
static void addSystemInclude(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, const Twine &Path)
Utility function to add a system include directory to CC1 arguments.
Definition: ToolChain.cpp:980
virtual unsigned getMaxDwarfVersion() const
Definition: ToolChain.h:555
path_list getStdlibPaths() const
Definition: ToolChain.cpp:616
virtual void adjustDebugInfoKind(llvm::codegenoptions::DebugInfoKind &DebugInfoKind, const llvm::opt::ArgList &Args) const
Adjust debug information kind considering all passed options.
Definition: ToolChain.h:575
virtual std::string computeSysRoot() const
Return the sysroot, possibly searching for a default sysroot using target-specific logic.
Definition: ToolChain.cpp:866
virtual bool useIntegratedAs() const
Check if the toolchain should use the integrated assembler.
Definition: ToolChain.cpp:132
virtual void AddHIPRuntimeLibArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
Add the system specific linker arguments to use for the given HIP runtime library type.
Definition: ToolChain.h:743
static llvm::Triple getOpenMPTriple(StringRef TripleStr)
Definition: ToolChain.h:769
virtual llvm::DenormalMode getDefaultDenormalModeForType(const llvm::opt::ArgList &DriverArgs, const JobAction &JA, const llvm::fltSemantics *FPType=nullptr) const
Returns the output denormal handling type in the default floating point environment for the given FPT...
Definition: ToolChain.h:761
const MultilibSet & getMultilibs() const
Definition: ToolChain.h:284
virtual llvm::opt::DerivedArgList * TranslateOpenMPTargetArgs(const llvm::opt::DerivedArgList &Args, bool SameTripleAsHost, SmallVectorImpl< llvm::opt::Arg * > &AllocatedArgs) const
TranslateOpenMPTargetArgs - Create a new derived argument list for that contains the OpenMP target sp...
Definition: ToolChain.cpp:1247
virtual unsigned GetDefaultDwarfVersion() const
Definition: ToolChain.h:550
virtual RuntimeLibType GetRuntimeLibType(const llvm::opt::ArgList &Args) const
Definition: ToolChain.cpp:892
virtual UnwindTableLevel getDefaultUnwindTableLevel(const llvm::opt::ArgList &Args) const
How detailed should the unwind tables be by default.
Definition: ToolChain.cpp:327
const char * getCompilerRTArgString(const llvm::opt::ArgList &Args, StringRef Component, FileType Type=ToolChain::FT_Static) const
Definition: ToolChain.cpp:567
bool ShouldLinkCXXStdlib(const llvm::opt::ArgList &Args) const
Returns if the C++ standard library should be linked in.
Definition: ToolChain.cpp:1082
static void addExternCSystemInclude(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, const Twine &Path)
Utility function to add a system include directory with extern "C" semantics to CC1 arguments.
Definition: ToolChain.cpp:995
virtual std::string getInputFilename(const InputInfo &Input) const
Some toolchains need to modify the file name, for example to replace the extension for object files w...
Definition: ToolChain.cpp:322
virtual Tool * buildStaticLibTool() const
Definition: ToolChain.cpp:351
virtual bool IsIntegratedBackendSupported() const
IsIntegratedBackendSupported - Does this tool chain support -fintegrated-objemitter.
Definition: ToolChain.h:409
std::string GetFilePath(const char *Name) const
Definition: ToolChain.cpp:671
virtual llvm::codegenoptions::DebugInfoFormat getDefaultDebugFormat() const
Get the default debug info format. Typically, this is DWARF.
Definition: ToolChain.h:537
path_list & getFilePaths()
Definition: ToolChain.h:278
virtual Tool * SelectTool(const JobAction &JA) const
Choose a tool to use to handle the action JA.
Definition: ToolChain.cpp:661
virtual bool supportsDebugInfoOption(const llvm::opt::Arg *) const
Does this toolchain supports given debug info option or not.
Definition: ToolChain.h:569
static bool needsProfileRT(const llvm::opt::ArgList &Args)
needsProfileRT - returns true if instrumentation profile is on.
Definition: ToolChain.cpp:641
StringRef getOS() const
Definition: ToolChain.h:255
virtual bool IsObjCNonFragileABIDefault() const
IsObjCNonFragileABIDefault - Does this tool chain set -fobjc-nonfragile-abi by default.
Definition: ToolChain.h:434
virtual bool isBareMetal() const
isBareMetal - Is this a bare metal target.
Definition: ToolChain.h:592
virtual bool isThreadModelSupported(const StringRef Model) const
isThreadModelSupported() - Does this target support a thread model?
Definition: ToolChain.cpp:800
llvm::Triple::ArchType getArch() const
Definition: ToolChain.h:252
const Driver & getDriver() const
Definition: ToolChain.h:236
virtual std::string detectLibcxxVersion(StringRef IncludePath) const
Definition: ToolChain.cpp:1027
static std::string concat(StringRef Path, const Twine &A, const Twine &B="", const Twine &C="", const Twine &D="")
Definition: ToolChain.cpp:1019
RTTIMode getRTTIMode() const
Definition: ToolChain.h:296
llvm::vfs::FileSystem & getVFS() const
Definition: ToolChain.cpp:128
static bool needsGCovInstrumentation(const llvm::opt::ArgList &Args)
Returns true if gcov instrumentation (-fprofile-arcs or –coverage) is on.
Definition: ToolChain.cpp:655
virtual void printVerboseInfo(raw_ostream &OS) const
Dispatch to the specific toolchain for verbose printing.
Definition: ToolChain.h:380
virtual std::string ComputeLLVMTriple(const llvm::opt::ArgList &Args, types::ID InputType=types::TY_INVALID) const
ComputeLLVMTriple - Return the LLVM target triple to use, after taking command line arguments into ac...
Definition: ToolChain.cpp:813
const path_list & getProgramPaths() const
Definition: ToolChain.h:282
const XRayArgs & getXRayArgs() const
Definition: ToolChain.cpp:181
virtual llvm::DebuggerKind getDefaultDebuggerTuning() const
Definition: ToolChain.h:564
virtual bool isPIEDefault(const llvm::opt::ArgList &Args) const =0
Test whether this toolchain defaults to PIE.
virtual bool SupportsEmbeddedBitcode() const
SupportsEmbeddedBitcode - Does this tool chain support embedded bitcode.
Definition: ToolChain.h:583
virtual bool isPICDefaultForced() const =0
Tests whether this toolchain forces its default for PIC, PIE or non-PIC.
void AddClangCXXStdlibIsystemArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
AddClangCXXStdlibIsystemArgs - Add the clang -cc1 level arguments to set the specified include paths ...
Definition: ToolChain.cpp:1064
bool addFastMathRuntimeIfAvailable(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
AddFastMathRuntimeIfAvailable - If a runtime library exists that sets global flags for unsafe floatin...
Definition: ToolChain.cpp:1139
path_list & getProgramPaths()
Definition: ToolChain.h:281
static void addExternCSystemIncludeIfExists(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, const Twine &Path)
Definition: ToolChain.cpp:1002
const path_list & getFilePaths() const
Definition: ToolChain.h:279
bool hasEffectiveTriple() const
Definition: ToolChain.h:271
virtual llvm::opt::DerivedArgList * TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch, Action::OffloadKind DeviceOffloadKind) const
TranslateArgs - Create a new derived argument list for any argument translations this ToolChain may w...
Definition: ToolChain.h:325
path_list getRuntimePaths() const
Definition: ToolChain.cpp:573
virtual bool useIntegratedBackend() const
Check if the toolchain should use the integrated backend.
Definition: ToolChain.cpp:138
const llvm::Triple & getEffectiveTriple() const
Get the toolchain's effective clang triple.
Definition: ToolChain.h:266
virtual LangOptions::TrivialAutoVarInitKind GetDefaultTrivialAutoVarInit() const
Get the default trivial automatic variable initialization.
Definition: ToolChain.h:455
std::string GetStaticLibToolPath() const
Returns the linker path for emitting a static library.
Definition: ToolChain.cpp:751
virtual llvm::ExceptionHandling GetExceptionModel(const llvm::opt::ArgList &Args) const
GetExceptionModel - Return the tool chain exception model.
Definition: ToolChain.cpp:796
virtual bool IsMathErrnoDefault() const
IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
Definition: ToolChain.h:426
virtual void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
AddCXXStdlibLibArgs - Add the system specific linker arguments to use for the given C++ standard libr...
Definition: ToolChain.cpp:1088
static ParsedClangName getTargetAndModeFromProgramName(StringRef ProgName)
Return any implicit target and/or mode flag for an invocation of the compiler driver as ProgName.
Definition: ToolChain.cpp:273
virtual bool IsIntegratedBackendDefault() const
IsIntegratedBackendDefault - Does this tool chain enable -fintegrated-objemitter by default.
Definition: ToolChain.h:405
virtual std::string getThreadModel() const
getThreadModel() - Which thread model does this target use?
Definition: ToolChain.h:586
virtual const char * getDefaultLinker() const
GetDefaultLinker - Get the default linker to use.
Definition: ToolChain.h:460
virtual bool GetDefaultStandaloneDebug() const
Definition: ToolChain.h:561
virtual Tool * buildLinker() const
Definition: ToolChain.cpp:347
const llvm::opt::Arg * getRTTIArg() const
Definition: ToolChain.h:293
const path_list & getLibraryPaths() const
Definition: ToolChain.h:276
const llvm::Triple & getTriple() const
Definition: ToolChain.h:238
bool defaultToIEEELongDouble() const
Check whether use IEEE binary128 as long double format by default.
Definition: ToolChain.cpp:170
virtual types::ID LookupTypeForExtension(StringRef Ext) const
LookupTypeForExtension - Return the default language type to use for the given extension.
Definition: ToolChain.cpp:758
virtual bool HasNativeLLVMSupport() const
HasNativeLTOLinker - Check whether the linker and related tools have native LLVM support.
Definition: ToolChain.cpp:770
virtual llvm::SmallVector< BitCodeLibraryInfo, 12 > getDeviceLibs(const llvm::opt::ArgList &Args) const
Get paths for device libraries.
Definition: ToolChain.cpp:1186
virtual UnwindLibType GetUnwindLibType(const llvm::opt::ArgList &Args) const
Definition: ToolChain.cpp:918
virtual void addProfileRTLibs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
addProfileRTLibs - When -fprofile-instr-profile is specified, try to pass a suitable profile runtime ...
Definition: ToolChain.cpp:884
virtual void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
Add arguments to use system-specific CUDA includes.
Definition: ToolChain.cpp:1179
virtual std::string getCompilerRTPath() const
Definition: ToolChain.cpp:492
virtual std::string buildCompilerRTBasename(const llvm::opt::ArgList &Args, StringRef Component, FileType Type, bool AddArch) const
Definition: ToolChain.cpp:512
std::string GetLinkerPath(bool *LinkerIsLLD=nullptr) const
Returns the linker path, respecting the -fuse-ld= argument to determine the linker suffix or name.
Definition: ToolChain.cpp:679
virtual std::string getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component, FileType Type=ToolChain::FT_Static) const
Definition: ToolChain.cpp:546
virtual Expected< SmallVector< std::string > > getSystemGPUArchs(const llvm::opt::ArgList &Args) const
getSystemGPUArchs - Use a tool to detect the user's availible GPUs.
Definition: ToolChain.cpp:1151
std::string GetProgramPath(const char *Name) const
Definition: ToolChain.cpp:675
virtual LangOptions::StackProtectorMode GetDefaultStackProtectorLevel(bool KernelOrKext) const
GetDefaultStackProtectorLevel - Get the default stack protector level for this tool chain.
Definition: ToolChain.h:449
virtual bool hasBlocksRuntime() const
hasBlocksRuntime - Given that the user is compiling with -fblocks, does this tool chain guarantee the...
Definition: ToolChain.h:626
virtual bool UseDwarfDebugFlags() const
UseDwarfDebugFlags - Embed the compile options to clang into the Dwarf compile unit information.
Definition: ToolChain.h:543
static void addSystemIncludes(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, ArrayRef< StringRef > Paths)
Utility function to add a list of system include directories to CC1.
Definition: ToolChain.cpp:1010
virtual bool SupportsProfiling() const
SupportsProfiling - Does this tool chain support -pg.
Definition: ToolChain.h:531
virtual void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
Add arguments to use system-specific HIP includes.
Definition: ToolChain.cpp:1182
virtual bool canSplitThinLTOUnit() const
Returns true when it's possible to split LTO unit to use whole program devirtualization and CFI santi...
Definition: ToolChain.h:756
virtual void AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
AddClangCXXStdlibIncludeArgs - Add the clang -cc1 level arguments to set the include paths to use for...
Definition: ToolChain.cpp:1050
virtual VersionTuple computeMSVCVersion(const Driver *D, const llvm::opt::ArgList &Args) const
On Windows, returns the MSVC compatibility version.
Definition: ToolChain.cpp:1207
virtual StringRef getOSLibName() const
Definition: ToolChain.cpp:472
virtual bool UseObjCMixedDispatch() const
UseObjCMixedDispatchDefault - When using non-legacy dispatch, should the mixed dispatch method be use...
Definition: ToolChain.h:438
virtual void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
Add arguments to use MCU GCC toolchain includes.
Definition: ToolChain.cpp:1190
virtual CXXStdlibType GetDefaultCXXStdlibType() const
Definition: ToolChain.h:467
void AddFilePathLibArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
AddFilePathLibArgs - Add each thing in getFilePaths() as a "-L" option.
Definition: ToolChain.cpp:1107
std::string getTripleString() const
Definition: ToolChain.h:261
virtual RuntimeLibType GetDefaultRuntimeLibType() const
GetDefaultRuntimeLibType - Get the default runtime library variant to use.
Definition: ToolChain.h:463
StringRef getDefaultUniversalArchName() const
Provide the default architecture name (as expected by -arch) for this toolchain.
Definition: ToolChain.cpp:297
virtual Tool * buildAssembler() const
Definition: ToolChain.cpp:343
void setTripleEnvironment(llvm::Triple::EnvironmentType Env)
Definition: ToolChain.cpp:120
virtual void addClangCC1ASTargetOptions(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CC1ASArgs) const
Add options that need to be passed to cc1as for this target.
Definition: ToolChain.cpp:879
virtual bool IsIntegratedAssemblerDefault() const
IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as by default.
Definition: ToolChain.h:401
SanitizerArgs getSanitizerArgs(const llvm::opt::ArgList &JobArgs) const
Definition: ToolChain.cpp:175
virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const
Definition: ToolChain.cpp:954
virtual void CheckObjCARC() const
Complain if this tool chain doesn't support Objective-C ARC.
Definition: ToolChain.h:534
virtual bool IsAArch64OutlineAtomicsDefault(const llvm::opt::ArgList &Args) const
Test whether this toolchain supports outline atomics by default.
Definition: ToolChain.h:514
llvm::Expected< std::unique_ptr< llvm::MemoryBuffer > > executeToolChainProgram(StringRef Executable) const
Executes the given Executable and returns the stdout.
Definition: ToolChain.cpp:94
virtual void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, Action::OffloadKind DeviceOffloadKind) const
Add options that need to be passed to cc1 for this target.
Definition: ToolChain.cpp:875
path_list & getLibraryPaths()
Definition: ToolChain.h:275
virtual void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
Add the clang cc1 arguments for system include paths.
Definition: ToolChain.cpp:870
virtual UnwindLibType GetDefaultUnwindLibType() const
Definition: ToolChain.h:471
virtual Tool * getTool(Action::ActionClass AC) const
Definition: ToolChain.cpp:403
const Multilib & getMultilib() const
Definition: ToolChain.h:286
virtual bool IsEncodeExtendedBlockSignatureDefault() const
IsEncodeExtendedBlockSignatureDefault - Does this tool chain enable -fencode-extended-block-signature...
Definition: ToolChain.h:430
StringRef getPlatform() const
Definition: ToolChain.h:254
virtual bool IsBlocksDefault() const
IsBlocksDefault - Does this tool chain enable -fblocks by default.
Definition: ToolChain.h:397
virtual SanitizerMask getSupportedSanitizers() const
Return sanitizers which are available in this toolchain.
Definition: ToolChain.cpp:1155
virtual path_list getArchSpecificLibPaths() const
Definition: ToolChain.cpp:625
virtual std::string getMultiarchTriple(const Driver &D, const llvm::Triple &TargetTriple, StringRef SysRoot) const
Definition: ToolChain.h:594
virtual bool isCrossCompiling() const
Returns true if the toolchain is targeting a non-native architecture.
Definition: ToolChain.cpp:774
std::string getCompilerRTBasename(const llvm::opt::ArgList &Args, StringRef Component, FileType Type=ToolChain::FT_Static) const
Definition: ToolChain.cpp:505
virtual bool IsNonIntegratedBackendSupported() const
IsNonIntegratedBackendSupported - Does this tool chain support -fno-integrated-objemitter.
Definition: ToolChain.h:413
virtual const llvm::Triple * getAuxTriple() const
Get the toolchain's aux triple, if it has one.
Definition: ToolChain.h:245
virtual SanitizerMask getDefaultSanitizers() const
Return sanitizers which are enabled by default.
Definition: ToolChain.h:750
virtual void TranslateXarchArgs(const llvm::opt::DerivedArgList &Args, llvm::opt::Arg *&A, llvm::opt::DerivedArgList *DAL, SmallVectorImpl< llvm::opt::Arg * > *AllocatedArgs=nullptr) const
Append the argument following A to DAL assuming A is an Xarch argument.
Definition: ToolChain.cpp:1319
virtual bool useRelaxRelocations() const
Check whether to enable x86 relax relocations by default.
Definition: ToolChain.cpp:166
virtual bool isPICDefault() const =0
Test whether this toolchain defaults to PIC.
StringRef getArchName() const
Definition: ToolChain.h:253
virtual bool parseInlineAsmUsingAsmParser() const
Check if the toolchain should use AsmParser to parse inlineAsm when integrated assembler is not defau...
Definition: ToolChain.h:423
SmallVector< std::string, 16 > path_list
Definition: ToolChain.h:93
virtual ObjCRuntime getDefaultObjCRuntime(bool isNonFragile) const
getDefaultObjCRuntime - Return the default Objective-C runtime for this platform.
Definition: ToolChain.cpp:790
Tool - Information on a specific compilation tool.
Definition: Tool.h:32
#define UINT_MAX
Definition: limits.h:60
@ C
Languages that the frontend can parse and compile.
YAML serialization mapping.
Definition: Dominators.h:30
Helper structure used to pass information extracted from clang executable name such as i686-linux-and...
Definition: ToolChain.h:64
ParsedClangName(std::string Suffix, const char *Mode)
Definition: ToolChain.h:78
const char * DriverMode
Corresponding driver mode argument, as '–driver-mode=g++'.
Definition: ToolChain.h:72
std::string ModeSuffix
Driver mode part of the executable name, as g++.
Definition: ToolChain.h:69
std::string TargetPrefix
Target part of the executable name, as i686-linux-android.
Definition: ToolChain.h:66
bool TargetIsValid
True if TargetPrefix is recognized as a registered target name.
Definition: ToolChain.h:75
ParsedClangName(std::string Target, std::string Suffix, const char *Mode, bool IsRegistered)
Definition: ToolChain.h:80
BitCodeLibraryInfo(StringRef Path, bool ShouldInternalize=true)
Definition: ToolChain.h:125