9#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_DARWIN_H
10#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_DARWIN_H
33 const llvm::opt::ArgList &Args);
36 virtual void anchor();
39 void AddMachOArch(
const llvm::opt::ArgList &Args,
40 llvm::opt::ArgStringList &CmdArgs)
const;
54 :
MachOTool(
"darwin::Assembler",
"assembler", TC) {}
60 const llvm::opt::ArgList &TCArgs,
61 const char *LinkingOutput)
const override;
66 void AddLinkArgs(
Compilation &C,
const llvm::opt::ArgList &Args,
67 llvm::opt::ArgStringList &CmdArgs,
69 bool LinkerIsLLD,
bool UsePlatformVersion)
const;
79 const llvm::opt::ArgList &TCArgs,
80 const char *LinkingOutput)
const override;
86 :
MachOTool(
"darwin::StaticLibTool",
"static-lib-linker", TC) {}
93 const llvm::opt::ArgList &TCArgs,
94 const char *LinkingOutput)
const override;
105 const llvm::opt::ArgList &TCArgs,
106 const char *LinkingOutput)
const override;
112 :
MachOTool(
"darwin::Dsymutil",
"dsymutil", TC) {}
119 const llvm::opt::ArgList &TCArgs,
120 const char *LinkingOutput)
const override;
126 :
MachOTool(
"darwin::VerifyDebug",
"dwarfdump", TC) {}
132 const llvm::opt::ArgList &TCArgs,
133 const char *LinkingOutput)
const override;
138namespace toolchains {
142 Tool *buildAssembler()
const override;
143 Tool *buildLinker()
const override;
144 Tool *buildStaticLibTool()
const override;
148 mutable std::unique_ptr<tools::darwin::Lipo> Lipo;
149 mutable std::unique_ptr<tools::darwin::Dsymutil> Dsymutil;
150 mutable std::unique_ptr<tools::darwin::VerifyDebug> VerifyDebug;
153 mutable std::optional<VersionTuple> LinkerVersion;
157 const llvm::opt::ArgList &Args);
165 StringRef getMachOArchName(
const llvm::opt::ArgList &Args)
const;
169 VersionTuple getLinkerVersion(
const llvm::opt::ArgList &Args)
const;
173 llvm::opt::ArgStringList &CmdArgs)
const {}
179 virtual void AddLinkRuntimeLibArgs(
const llvm::opt::ArgList &Args,
180 llvm::opt::ArgStringList &CmdArgs,
181 bool ForceLinkBuiltinRT =
false)
const;
184 llvm::opt::ArgStringList &CmdArgs)
const {
188 llvm::opt::ArgStringList &CmdArgs)
const {}
191 llvm::opt::ArgStringList &CmdArgs)
const {
204 RLO_AlwaysLink = 1 << 0,
207 RLO_IsEmbedded = 1 << 1,
210 RLO_AddRPath = 1 << 2,
214 void AddLinkRuntimeLib(
const llvm::opt::ArgList &Args,
215 llvm::opt::ArgStringList &CmdArgs, StringRef Component,
216 RuntimeLinkOptions Opts = RuntimeLinkOptions(),
217 bool IsShared =
false)
const;
222 llvm::opt::ArgStringList &CmdArgs)
const override {
230 getCompilerRT(
const llvm::opt::ArgList &Args, StringRef Component,
237 types::ID LookupTypeForExtension(StringRef Ext)
const override;
239 bool HasNativeLLVMSupport()
const override;
241 llvm::opt::DerivedArgList *
242 TranslateArgs(
const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
257 return getTriple().getArch() != llvm::Triple::x86;
263 getDefaultUnwindTableLevel(
const llvm::opt::ArgList &Args)
const override;
266 return ToolChain::RLT_CompilerRT;
269 bool isPICDefault()
const override;
270 bool isPIEDefault(
const llvm::opt::ArgList &Args)
const override;
271 bool isPICDefaultForced()
const override;
273 bool SupportsProfiling()
const override;
275 bool UseDwarfDebugFlags()
const override;
276 std::string GetGlobalDebugPathRemapping()
const override;
278 llvm::ExceptionHandling
280 return llvm::ExceptionHandling::None;
310 LastDarwinPlatform = XROS
336 void AddDeploymentTarget(llvm::opt::DerivedArgList &Args)
const;
340 const llvm::opt::ArgList &Args);
343 std::string ComputeEffectiveClangTriple(
const llvm::opt::ArgList &Args,
349 void addMinVersionArgs(
const llvm::opt::ArgList &Args,
350 llvm::opt::ArgStringList &CmdArgs)
const override;
352 void addPlatformVersionArgs(
const llvm::opt::ArgList &Args,
353 llvm::opt::ArgStringList &CmdArgs)
const override;
355 void addStartObjectFileArgs(
const llvm::opt::ArgList &Args,
356 llvm::opt::ArgStringList &CmdArgs)
const override;
359 return (!(isTargetIPhoneOS() && !isIPhoneOSVersionLT(6, 0)) &&
360 !isTargetWatchOS() && !isTargetDriverKit());
363 void addProfileRTLibs(
const llvm::opt::ArgList &Args,
364 llvm::opt::ArgStringList &CmdArgs)
const override;
369 getCompilerRT(
const llvm::opt::ArgList &Args, StringRef Component,
380 unsigned Major,
unsigned Minor,
unsigned Micro,
381 VersionTuple NativeTargetVersion)
const {
384 if (TargetInitialized && TargetPlatform == Platform &&
385 TargetEnvironment == Environment &&
386 (Environment == MacCatalyst ? OSTargetVersion :
TargetVersion) ==
387 VersionTuple(Major, Minor, Micro))
390 assert(!TargetInitialized &&
"Target already initialized!");
391 TargetInitialized =
true;
392 TargetPlatform = Platform;
393 TargetEnvironment = Environment;
395 if (Environment == Simulator)
396 const_cast<Darwin *
>(
this)->setTripleEnvironment(llvm::Triple::Simulator);
397 else if (Environment == MacCatalyst) {
398 const_cast<Darwin *
>(
this)->setTripleEnvironment(llvm::Triple::MacABI);
400 OSTargetVersion = VersionTuple(Major, Minor, Micro);
406 assert(TargetInitialized &&
"Target not initialized!");
407 return (TargetPlatform == IPhoneOS || TargetPlatform == TvOS) &&
408 TargetEnvironment == NativeEnvironment;
412 assert(TargetInitialized &&
"Target not initialized!");
413 return (TargetPlatform == IPhoneOS || TargetPlatform == TvOS) &&
414 TargetEnvironment == Simulator;
418 assert(TargetInitialized &&
"Target not initialized!");
419 return isTargetIPhoneOS() || isTargetIOSSimulator();
423 return TargetPlatform == XROS && TargetEnvironment == NativeEnvironment;
427 return TargetPlatform == XROS && TargetEnvironment == Simulator;
433 assert(TargetInitialized &&
"Target not initialized!");
434 return TargetPlatform == TvOS && TargetEnvironment == NativeEnvironment;
438 assert(TargetInitialized &&
"Target not initialized!");
439 return TargetPlatform == TvOS && TargetEnvironment == Simulator;
443 assert(TargetInitialized &&
"Target not initialized!");
444 return TargetPlatform == TvOS;
448 assert(TargetInitialized &&
"Target not initialized!");
449 return TargetPlatform == WatchOS && TargetEnvironment == NativeEnvironment;
453 assert(TargetInitialized &&
"Target not initialized!");
454 return TargetPlatform == WatchOS && TargetEnvironment == Simulator;
458 assert(TargetInitialized &&
"Target not initialized!");
459 return TargetPlatform == WatchOS;
463 assert(TargetInitialized &&
"Target not initialized!");
464 return TargetPlatform == DriverKit;
468 return TargetPlatform == IPhoneOS && TargetEnvironment == MacCatalyst;
472 assert(TargetInitialized &&
"Target not initialized!");
473 return TargetPlatform == MacOS;
477 assert(TargetInitialized &&
"Target not initialized!");
478 return TargetPlatform == MacOS || isTargetMacCatalyst();
482 assert(TargetInitialized &&
"Target not initialized!");
483 return isTargetMacOSBased() && getArch() == llvm::Triple::aarch64;
493 assert(TargetInitialized &&
"Target not initialized!");
494 return isTargetMacCatalyst() ? OSTargetVersion :
TargetVersion;
498 unsigned V2 = 0)
const {
499 assert(isTargetIOSBased() &&
"Unexpected call for non iOS target!");
508 assert(isTargetMacOSBased() &&
509 (getTriple().isMacOSX() || getTriple().isMacCatalystEnvironment()) &&
510 "Unexpected call for non OS X target!");
513 VersionTuple MinVers =
514 llvm::Triple(getTriple().getArchName(),
"apple",
"macos")
515 .getMinimumSupportedOSVersion();
525 bool isAlignedAllocationUnavailable()
const;
529 bool isSizedDeallocationUnavailable()
const;
531 void addClangTargetOptions(
const llvm::opt::ArgList &DriverArgs,
532 llvm::opt::ArgStringList &CC1Args,
535 void addClangCC1ASTargetOptions(
536 const llvm::opt::ArgList &Args,
537 llvm::opt::ArgStringList &CC1ASArgs)
const override;
539 StringRef getPlatformFamily()
const;
540 StringRef getOSLibraryNameSuffix(
bool IgnoreSim =
false)
const override;
543 static StringRef getSDKName(StringRef isysroot);
554 llvm::opt::DerivedArgList *
555 TranslateArgs(
const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
558 CXXStdlibType GetDefaultCXXStdlibType()
const override;
559 ObjCRuntime getDefaultObjCRuntime(
bool isNonFragile)
const override;
560 bool hasBlocksRuntime()
const override;
562 void AddCudaIncludeArgs(
const llvm::opt::ArgList &DriverArgs,
563 llvm::opt::ArgStringList &CC1Args)
const override;
564 void AddHIPIncludeArgs(
const llvm::opt::ArgList &DriverArgs,
565 llvm::opt::ArgStringList &CC1Args)
const override;
571 return !(isTargetMacOSBased() && isMacosxVersionLT(10, 6));
578 if (isTargetIOSBased() || isTargetWatchOSBased() || isTargetDriverKit() ||
580 return LangOptions::SSPOn;
581 else if (isTargetMacOSBased() && !isMacosxVersionLT(10, 6))
582 return LangOptions::SSPOn;
583 else if (isTargetMacOSBased() && !isMacosxVersionLT(10, 5) && !KernelOrKext)
584 return LangOptions::SSPOn;
586 return LangOptions::SSPOff;
589 void CheckObjCARC()
const override;
591 llvm::ExceptionHandling GetExceptionModel(
592 const llvm::opt::ArgList &Args)
const override;
594 bool SupportsEmbeddedBitcode()
const override;
598 void printVerboseInfo(raw_ostream &OS)
const override;
605 const llvm::opt::ArgList &Args);
610 RuntimeLibType GetRuntimeLibType(
const llvm::opt::ArgList &Args)
const override;
612 void AddLinkRuntimeLibArgs(
const llvm::opt::ArgList &Args,
613 llvm::opt::ArgStringList &CmdArgs,
614 bool ForceLinkBuiltinRT =
false)
const override;
616 void AddClangCXXStdlibIncludeArgs(
617 const llvm::opt::ArgList &DriverArgs,
618 llvm::opt::ArgStringList &CC1Args)
const override;
620 void AddClangSystemIncludeArgs(
const llvm::opt::ArgList &DriverArgs,
621 llvm::opt::ArgStringList &CC1Args)
const override;
623 void AddCXXStdlibLibArgs(
const llvm::opt::ArgList &Args,
624 llvm::opt::ArgStringList &CmdArgs)
const override;
626 void AddCCKextLibArgs(
const llvm::opt::ArgList &Args,
627 llvm::opt::ArgStringList &CmdArgs)
const override;
629 void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args)
const override;
631 void AddLinkARCArgs(
const llvm::opt::ArgList &Args,
632 llvm::opt::ArgStringList &CmdArgs)
const override;
634 unsigned GetDefaultDwarfVersion()
const override;
639 return llvm::DebuggerKind::LLDB;
645 void AddLinkSanitizerLibArgs(
const llvm::opt::ArgList &Args,
646 llvm::opt::ArgStringList &CmdArgs,
648 bool shared =
true)
const;
650 bool AddGnuCPlusPlusIncludePaths(
const llvm::opt::ArgList &DriverArgs,
651 llvm::opt::ArgStringList &CC1Args,
653 llvm::StringRef Version,
654 llvm::StringRef ArchDir,
655 llvm::StringRef BitDir)
const;
658 GetEffectiveSysroot(
const llvm::opt::ArgList &DriverArgs)
const;
Defines the clang::LangOptions interface.
llvm::MachO::FileType FileType
Simple wrapper for toolchain detector with costly initialization.
The basic abstraction for the target Objective-C runtime.
The base class of the type hierarchy.
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...
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T