clang 19.0.0git
Darwin.h
Go to the documentation of this file.
1//===--- Darwin.h - Darwin ToolChain Implementations ------------*- 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_DARWIN_H
10#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_DARWIN_H
11
12#include "Cuda.h"
13#include "LazyDetector.h"
14#include "ROCm.h"
17#include "clang/Driver/Tool.h"
20
21namespace clang {
22namespace driver {
23
24namespace toolchains {
25class MachO;
26} // end namespace toolchains
27
28namespace tools {
29
30namespace darwin {
31llvm::Triple::ArchType getArchTypeForMachOArchName(StringRef Str);
32void setTripleTypeForMachOArchName(llvm::Triple &T, StringRef Str,
33 const llvm::opt::ArgList &Args);
34
35class LLVM_LIBRARY_VISIBILITY MachOTool : public Tool {
36 virtual void anchor();
37
38protected:
39 void AddMachOArch(const llvm::opt::ArgList &Args,
40 llvm::opt::ArgStringList &CmdArgs) const;
41
43 return reinterpret_cast<const toolchains::MachO &>(getToolChain());
44 }
45
46public:
47 MachOTool(const char *Name, const char *ShortName, const ToolChain &TC)
48 : Tool(Name, ShortName, TC) {}
49};
50
51class LLVM_LIBRARY_VISIBILITY Assembler : public MachOTool {
52public:
54 : MachOTool("darwin::Assembler", "assembler", TC) {}
55
56 bool hasIntegratedCPP() const override { return false; }
57
58 void ConstructJob(Compilation &C, const JobAction &JA,
59 const InputInfo &Output, const InputInfoList &Inputs,
60 const llvm::opt::ArgList &TCArgs,
61 const char *LinkingOutput) const override;
62};
63
64class LLVM_LIBRARY_VISIBILITY Linker : public MachOTool {
65 bool NeedsTempPath(const InputInfoList &Inputs) const;
66 void AddLinkArgs(Compilation &C, const llvm::opt::ArgList &Args,
67 llvm::opt::ArgStringList &CmdArgs,
68 const InputInfoList &Inputs, VersionTuple Version,
69 bool LinkerIsLLD, bool UsePlatformVersion) const;
70
71public:
72 Linker(const ToolChain &TC) : MachOTool("darwin::Linker", "linker", TC) {}
73
74 bool hasIntegratedCPP() const override { return false; }
75 bool isLinkJob() const override { return true; }
76
77 void ConstructJob(Compilation &C, const JobAction &JA,
78 const InputInfo &Output, const InputInfoList &Inputs,
79 const llvm::opt::ArgList &TCArgs,
80 const char *LinkingOutput) const override;
81};
82
83class LLVM_LIBRARY_VISIBILITY StaticLibTool : public MachOTool {
84public:
86 : MachOTool("darwin::StaticLibTool", "static-lib-linker", TC) {}
87
88 bool hasIntegratedCPP() const override { return false; }
89 bool isLinkJob() const override { return true; }
90
91 void ConstructJob(Compilation &C, const JobAction &JA,
92 const InputInfo &Output, const InputInfoList &Inputs,
93 const llvm::opt::ArgList &TCArgs,
94 const char *LinkingOutput) const override;
95};
96
97class LLVM_LIBRARY_VISIBILITY Lipo : public MachOTool {
98public:
99 Lipo(const ToolChain &TC) : MachOTool("darwin::Lipo", "lipo", TC) {}
100
101 bool hasIntegratedCPP() const override { return false; }
102
103 void ConstructJob(Compilation &C, const JobAction &JA,
104 const InputInfo &Output, const InputInfoList &Inputs,
105 const llvm::opt::ArgList &TCArgs,
106 const char *LinkingOutput) const override;
107};
108
109class LLVM_LIBRARY_VISIBILITY Dsymutil : public MachOTool {
110public:
112 : MachOTool("darwin::Dsymutil", "dsymutil", TC) {}
113
114 bool hasIntegratedCPP() const override { return false; }
115 bool isDsymutilJob() const override { return true; }
116
117 void ConstructJob(Compilation &C, const JobAction &JA,
118 const InputInfo &Output, const InputInfoList &Inputs,
119 const llvm::opt::ArgList &TCArgs,
120 const char *LinkingOutput) const override;
121};
122
123class LLVM_LIBRARY_VISIBILITY VerifyDebug : public MachOTool {
124public:
126 : MachOTool("darwin::VerifyDebug", "dwarfdump", TC) {}
127
128 bool hasIntegratedCPP() const override { return false; }
129
130 void ConstructJob(Compilation &C, const JobAction &JA,
131 const InputInfo &Output, const InputInfoList &Inputs,
132 const llvm::opt::ArgList &TCArgs,
133 const char *LinkingOutput) const override;
134};
135} // end namespace darwin
136} // end namespace tools
137
138namespace toolchains {
139
140class LLVM_LIBRARY_VISIBILITY MachO : public ToolChain {
141protected:
142 Tool *buildAssembler() const override;
143 Tool *buildLinker() const override;
144 Tool *buildStaticLibTool() const override;
145 Tool *getTool(Action::ActionClass AC) const override;
146
147private:
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;
151
152 /// The version of the linker known to be available in the tool chain.
153 mutable std::optional<VersionTuple> LinkerVersion;
154
155public:
156 MachO(const Driver &D, const llvm::Triple &Triple,
157 const llvm::opt::ArgList &Args);
158 ~MachO() override;
159
160 /// @name MachO specific toolchain API
161 /// {
162
163 /// Get the "MachO" arch name for a particular compiler invocation. For
164 /// example, Apple treats different ARM variations as distinct architectures.
165 StringRef getMachOArchName(const llvm::opt::ArgList &Args) const;
166
167 /// Get the version of the linker known to be available for a particular
168 /// compiler invocation (via the `-mlinker-version=` arg).
169 VersionTuple getLinkerVersion(const llvm::opt::ArgList &Args) const;
170
171 /// Add the linker arguments to link the ARC runtime library.
172 virtual void AddLinkARCArgs(const llvm::opt::ArgList &Args,
173 llvm::opt::ArgStringList &CmdArgs) const {}
174
175 /// Add the linker arguments to link the compiler runtime library.
176 ///
177 /// FIXME: This API is intended for use with embedded libraries only, and is
178 /// misleadingly named.
179 virtual void AddLinkRuntimeLibArgs(const llvm::opt::ArgList &Args,
180 llvm::opt::ArgStringList &CmdArgs,
181 bool ForceLinkBuiltinRT = false) const;
182
183 virtual void addStartObjectFileArgs(const llvm::opt::ArgList &Args,
184 llvm::opt::ArgStringList &CmdArgs) const {
185 }
186
187 virtual void addMinVersionArgs(const llvm::opt::ArgList &Args,
188 llvm::opt::ArgStringList &CmdArgs) const {}
189
190 virtual void addPlatformVersionArgs(const llvm::opt::ArgList &Args,
191 llvm::opt::ArgStringList &CmdArgs) const {
192 }
193
194 /// On some iOS platforms, kernel and kernel modules were built statically. Is
195 /// this such a target?
196 virtual bool isKernelStatic() const { return false; }
197
198 /// Is the target either iOS or an iOS simulator?
199 bool isTargetIOSBased() const { return false; }
200
201 /// Options to control how a runtime library is linked.
202 enum RuntimeLinkOptions : unsigned {
203 /// Link the library in even if it can't be found in the VFS.
204 RLO_AlwaysLink = 1 << 0,
205
206 /// Use the embedded runtime from the macho_embedded directory.
207 RLO_IsEmbedded = 1 << 1,
208
209 /// Emit rpaths for @executable_path as well as the resource directory.
210 RLO_AddRPath = 1 << 2,
211 };
212
213 /// Add a runtime library to the list of items to link.
214 void AddLinkRuntimeLib(const llvm::opt::ArgList &Args,
215 llvm::opt::ArgStringList &CmdArgs, StringRef Component,
216 RuntimeLinkOptions Opts = RuntimeLinkOptions(),
217 bool IsShared = false) const;
218
219 /// Add any profiling runtime libraries that are needed. This is essentially a
220 /// MachO specific version of addProfileRT in Tools.cpp.
221 void addProfileRTLibs(const llvm::opt::ArgList &Args,
222 llvm::opt::ArgStringList &CmdArgs) const override {
223 // There aren't any profiling libs for embedded targets currently.
224 }
225
226 /// }
227 /// @name ToolChain Implementation
228 /// {
229
230 types::ID LookupTypeForExtension(StringRef Ext) const override;
231
232 bool HasNativeLLVMSupport() const override;
233
234 llvm::opt::DerivedArgList *
235 TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
236 Action::OffloadKind DeviceOffloadKind) const override;
237
238 bool IsBlocksDefault() const override {
239 // Always allow blocks on Apple; users interested in versioning are
240 // expected to use /usr/include/Block.h.
241 return true;
242 }
243
244 bool IsMathErrnoDefault() const override { return false; }
245
246 bool IsEncodeExtendedBlockSignatureDefault() const override { return true; }
247
248 bool IsObjCNonFragileABIDefault() const override {
249 // Non-fragile ABI is default for everything but i386.
250 return getTriple().getArch() != llvm::Triple::x86;
251 }
252
253 bool UseObjCMixedDispatch() const override { return true; }
254
255 UnwindTableLevel
256 getDefaultUnwindTableLevel(const llvm::opt::ArgList &Args) const override;
257
259 return ToolChain::RLT_CompilerRT;
260 }
261
262 bool isPICDefault() const override;
263 bool isPIEDefault(const llvm::opt::ArgList &Args) const override;
264 bool isPICDefaultForced() const override;
265
266 bool SupportsProfiling() const override;
267
268 bool UseDwarfDebugFlags() const override;
269 std::string GetGlobalDebugPathRemapping() const override;
270
271 llvm::ExceptionHandling
272 GetExceptionModel(const llvm::opt::ArgList &Args) const override {
273 return llvm::ExceptionHandling::None;
274 }
275
276 virtual StringRef getOSLibraryNameSuffix(bool IgnoreSim = false) const {
277 return "";
278 }
279
280 // Darwin toolchain uses legacy thin LTO API, which is not
281 // capable of unit splitting.
282 bool canSplitThinLTOUnit() const override { return false; }
283 /// }
284};
285
286/// Darwin - The base Darwin tool chain.
287class LLVM_LIBRARY_VISIBILITY Darwin : public MachO {
288public:
289 /// Whether the information on the target has been initialized.
290 //
291 // FIXME: This should be eliminated. What we want to do is make this part of
292 // the "default target for arguments" selection process, once we get out of
293 // the argument translation business.
294 mutable bool TargetInitialized;
295
303 LastDarwinPlatform = XROS
304 };
309 };
310
313
314 /// The native OS version we are targeting.
315 mutable VersionTuple TargetVersion;
316 /// The OS version we are targeting as specified in the triple.
317 mutable VersionTuple OSTargetVersion;
318
319 /// The information about the darwin SDK that was used.
320 mutable std::optional<DarwinSDKInfo> SDKInfo;
321
322 /// The target variant triple that was specified (if any).
323 mutable std::optional<llvm::Triple> TargetVariantTriple;
324
327
328private:
329 void AddDeploymentTarget(llvm::opt::DerivedArgList &Args) const;
330
331public:
332 Darwin(const Driver &D, const llvm::Triple &Triple,
333 const llvm::opt::ArgList &Args);
334 ~Darwin() override;
335
336 std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args,
337 types::ID InputType) const override;
338
339 /// @name Apple Specific Toolchain Implementation
340 /// {
341
342 void addMinVersionArgs(const llvm::opt::ArgList &Args,
343 llvm::opt::ArgStringList &CmdArgs) const override;
344
345 void addPlatformVersionArgs(const llvm::opt::ArgList &Args,
346 llvm::opt::ArgStringList &CmdArgs) const override;
347
348 void addStartObjectFileArgs(const llvm::opt::ArgList &Args,
349 llvm::opt::ArgStringList &CmdArgs) const override;
350
351 bool isKernelStatic() const override {
352 return (!(isTargetIPhoneOS() && !isIPhoneOSVersionLT(6, 0)) &&
353 !isTargetWatchOS() && !isTargetDriverKit());
354 }
355
356 void addProfileRTLibs(const llvm::opt::ArgList &Args,
357 llvm::opt::ArgStringList &CmdArgs) const override;
358
359protected:
360 /// }
361 /// @name Darwin specific Toolchain functions
362 /// {
363
364 // FIXME: Eliminate these ...Target functions and derive separate tool chains
365 // for these targets and put version in constructor.
367 unsigned Major, unsigned Minor, unsigned Micro,
368 VersionTuple NativeTargetVersion) const {
369 // FIXME: For now, allow reinitialization as long as values don't
370 // change. This will go away when we move away from argument translation.
371 if (TargetInitialized && TargetPlatform == Platform &&
372 TargetEnvironment == Environment &&
373 (Environment == MacCatalyst ? OSTargetVersion : TargetVersion) ==
374 VersionTuple(Major, Minor, Micro))
375 return;
376
377 assert(!TargetInitialized && "Target already initialized!");
378 TargetInitialized = true;
379 TargetPlatform = Platform;
380 TargetEnvironment = Environment;
381 TargetVersion = VersionTuple(Major, Minor, Micro);
382 if (Environment == Simulator)
383 const_cast<Darwin *>(this)->setTripleEnvironment(llvm::Triple::Simulator);
384 else if (Environment == MacCatalyst) {
385 const_cast<Darwin *>(this)->setTripleEnvironment(llvm::Triple::MacABI);
386 TargetVersion = NativeTargetVersion;
387 OSTargetVersion = VersionTuple(Major, Minor, Micro);
388 }
389 }
390
391public:
392 bool isTargetIPhoneOS() const {
393 assert(TargetInitialized && "Target not initialized!");
394 return (TargetPlatform == IPhoneOS || TargetPlatform == TvOS) &&
395 TargetEnvironment == NativeEnvironment;
396 }
397
398 bool isTargetIOSSimulator() const {
399 assert(TargetInitialized && "Target not initialized!");
400 return (TargetPlatform == IPhoneOS || TargetPlatform == TvOS) &&
401 TargetEnvironment == Simulator;
402 }
403
404 bool isTargetIOSBased() const {
405 assert(TargetInitialized && "Target not initialized!");
406 return isTargetIPhoneOS() || isTargetIOSSimulator();
407 }
408
409 bool isTargetXROSDevice() const {
410 return TargetPlatform == XROS && TargetEnvironment == NativeEnvironment;
411 }
412
414 return TargetPlatform == XROS && TargetEnvironment == Simulator;
415 }
416
417 bool isTargetXROS() const { return TargetPlatform == XROS; }
418
419 bool isTargetTvOS() const {
420 assert(TargetInitialized && "Target not initialized!");
421 return TargetPlatform == TvOS && TargetEnvironment == NativeEnvironment;
422 }
423
425 assert(TargetInitialized && "Target not initialized!");
426 return TargetPlatform == TvOS && TargetEnvironment == Simulator;
427 }
428
429 bool isTargetTvOSBased() const {
430 assert(TargetInitialized && "Target not initialized!");
431 return TargetPlatform == TvOS;
432 }
433
434 bool isTargetWatchOS() const {
435 assert(TargetInitialized && "Target not initialized!");
436 return TargetPlatform == WatchOS && TargetEnvironment == NativeEnvironment;
437 }
438
440 assert(TargetInitialized && "Target not initialized!");
441 return TargetPlatform == WatchOS && TargetEnvironment == Simulator;
442 }
443
444 bool isTargetWatchOSBased() const {
445 assert(TargetInitialized && "Target not initialized!");
446 return TargetPlatform == WatchOS;
447 }
448
449 bool isTargetDriverKit() const {
450 assert(TargetInitialized && "Target not initialized!");
451 return TargetPlatform == DriverKit;
452 }
453
454 bool isTargetMacCatalyst() const {
455 return TargetPlatform == IPhoneOS && TargetEnvironment == MacCatalyst;
456 }
457
458 bool isTargetMacOS() const {
459 assert(TargetInitialized && "Target not initialized!");
460 return TargetPlatform == MacOS;
461 }
462
463 bool isTargetMacOSBased() const {
464 assert(TargetInitialized && "Target not initialized!");
465 return TargetPlatform == MacOS || isTargetMacCatalyst();
466 }
467
469 assert(TargetInitialized && "Target not initialized!");
470 return isTargetMacOSBased() && getArch() == llvm::Triple::aarch64;
471 }
472
473 bool isTargetInitialized() const { return TargetInitialized; }
474
475 /// The version of the OS that's used by the OS specified in the target
476 /// triple. It might be different from the actual target OS on which the
477 /// program will run, e.g. MacCatalyst code runs on a macOS target, but its
478 /// target triple is iOS.
479 VersionTuple getTripleTargetVersion() const {
480 assert(TargetInitialized && "Target not initialized!");
481 return isTargetMacCatalyst() ? OSTargetVersion : TargetVersion;
482 }
483
484 bool isIPhoneOSVersionLT(unsigned V0, unsigned V1 = 0,
485 unsigned V2 = 0) const {
486 assert(isTargetIOSBased() && "Unexpected call for non iOS target!");
487 return TargetVersion < VersionTuple(V0, V1, V2);
488 }
489
490 /// Returns true if the minimum supported macOS version for the slice that's
491 /// being built is less than the specified version. If there's no minimum
492 /// supported macOS version, the deployment target version is compared to the
493 /// specifed version instead.
494 bool isMacosxVersionLT(unsigned V0, unsigned V1 = 0, unsigned V2 = 0) const {
495 assert(isTargetMacOSBased() &&
496 (getTriple().isMacOSX() || getTriple().isMacCatalystEnvironment()) &&
497 "Unexpected call for non OS X target!");
498 // The effective triple might not be initialized yet, so construct a
499 // pseudo-effective triple to get the minimum supported OS version.
500 VersionTuple MinVers =
501 llvm::Triple(getTriple().getArchName(), "apple", "macos")
502 .getMinimumSupportedOSVersion();
503 return (!MinVers.empty() && MinVers > TargetVersion
504 ? MinVers
505 : TargetVersion) < VersionTuple(V0, V1, V2);
506 }
507
508protected:
509 /// Return true if c++17 aligned allocation/deallocation functions are not
510 /// implemented in the c++ standard library of the deployment target we are
511 /// targeting.
512 bool isAlignedAllocationUnavailable() const;
513
514 /// Return true if c++14 sized deallocation functions are not implemented in
515 /// the c++ standard library of the deployment target we are targeting.
516 bool isSizedDeallocationUnavailable() const;
517
518 void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
519 llvm::opt::ArgStringList &CC1Args,
520 Action::OffloadKind DeviceOffloadKind) const override;
521
522 void addClangCC1ASTargetOptions(
523 const llvm::opt::ArgList &Args,
524 llvm::opt::ArgStringList &CC1ASArgs) const override;
525
526 StringRef getPlatformFamily() const;
527 StringRef getOSLibraryNameSuffix(bool IgnoreSim = false) const override;
528
529public:
530 static StringRef getSDKName(StringRef isysroot);
531
532 /// }
533 /// @name ToolChain Implementation
534 /// {
535
536 // Darwin tools support multiple architecture (e.g., i386 and x86_64) and
537 // most development is done against SDKs, so compiling for a different
538 // architecture should not get any special treatment.
539 bool isCrossCompiling() const override { return false; }
540
541 llvm::opt::DerivedArgList *
542 TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
543 Action::OffloadKind DeviceOffloadKind) const override;
544
545 CXXStdlibType GetDefaultCXXStdlibType() const override;
546 ObjCRuntime getDefaultObjCRuntime(bool isNonFragile) const override;
547 bool hasBlocksRuntime() const override;
548
549 void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs,
550 llvm::opt::ArgStringList &CC1Args) const override;
551 void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs,
552 llvm::opt::ArgStringList &CC1Args) const override;
553
554 bool UseObjCMixedDispatch() const override {
555 // This is only used with the non-fragile ABI and non-legacy dispatch.
556
557 // Mixed dispatch is used everywhere except OS X before 10.6.
558 return !(isTargetMacOSBased() && isMacosxVersionLT(10, 6));
559 }
560
562 GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
563 // Stack protectors default to on for user code on 10.5,
564 // and for everything in 10.6 and beyond
565 if (isTargetIOSBased() || isTargetWatchOSBased() || isTargetDriverKit() ||
566 isTargetXROS())
567 return LangOptions::SSPOn;
568 else if (isTargetMacOSBased() && !isMacosxVersionLT(10, 6))
569 return LangOptions::SSPOn;
570 else if (isTargetMacOSBased() && !isMacosxVersionLT(10, 5) && !KernelOrKext)
571 return LangOptions::SSPOn;
572
573 return LangOptions::SSPOff;
574 }
575
576 void CheckObjCARC() const override;
577
578 llvm::ExceptionHandling GetExceptionModel(
579 const llvm::opt::ArgList &Args) const override;
580
581 bool SupportsEmbeddedBitcode() const override;
582
583 SanitizerMask getSupportedSanitizers() const override;
584
585 void printVerboseInfo(raw_ostream &OS) const override;
586};
587
588/// DarwinClang - The Darwin toolchain used by Clang.
589class LLVM_LIBRARY_VISIBILITY DarwinClang : public Darwin {
590public:
591 DarwinClang(const Driver &D, const llvm::Triple &Triple,
592 const llvm::opt::ArgList &Args);
593
594 /// @name Apple ToolChain Implementation
595 /// {
596
597 RuntimeLibType GetRuntimeLibType(const llvm::opt::ArgList &Args) const override;
598
599 void AddLinkRuntimeLibArgs(const llvm::opt::ArgList &Args,
600 llvm::opt::ArgStringList &CmdArgs,
601 bool ForceLinkBuiltinRT = false) const override;
602
603 void AddClangCXXStdlibIncludeArgs(
604 const llvm::opt::ArgList &DriverArgs,
605 llvm::opt::ArgStringList &CC1Args) const override;
606
607 void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
608 llvm::opt::ArgStringList &CC1Args) const override;
609
610 void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
611 llvm::opt::ArgStringList &CmdArgs) const override;
612
613 void AddCCKextLibArgs(const llvm::opt::ArgList &Args,
614 llvm::opt::ArgStringList &CmdArgs) const override;
615
616 void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const override;
617
618 void AddLinkARCArgs(const llvm::opt::ArgList &Args,
619 llvm::opt::ArgStringList &CmdArgs) const override;
620
621 unsigned GetDefaultDwarfVersion() const override;
622 // Until dtrace (via CTF) and LLDB can deal with distributed debug info,
623 // Darwin defaults to standalone/full debug info.
624 bool GetDefaultStandaloneDebug() const override { return true; }
625 llvm::DebuggerKind getDefaultDebuggerTuning() const override {
626 return llvm::DebuggerKind::LLDB;
627 }
628
629 /// }
630
631private:
632 void AddLinkSanitizerLibArgs(const llvm::opt::ArgList &Args,
633 llvm::opt::ArgStringList &CmdArgs,
634 StringRef Sanitizer,
635 bool shared = true) const;
636
637 bool AddGnuCPlusPlusIncludePaths(const llvm::opt::ArgList &DriverArgs,
638 llvm::opt::ArgStringList &CC1Args,
640 llvm::StringRef Version,
641 llvm::StringRef ArchDir,
642 llvm::StringRef BitDir) const;
643
645 GetEffectiveSysroot(const llvm::opt::ArgList &DriverArgs) const;
646};
647
648} // end namespace toolchains
649} // end namespace driver
650} // end namespace clang
651
652#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_DARWIN_H
Defines the clang::LangOptions interface.
int32_t ShortName
Definition: SemaARM.cpp:1093
Simple wrapper for toolchain detector with costly initialization.
Definition: LazyDetector.h:21
The basic abstraction for the target Objective-C runtime.
Definition: ObjCRuntime.h:28
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:45
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
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:92
Tool - Information on a specific compilation tool.
Definition: Tool.h:32
DarwinClang - The Darwin toolchain used by Clang.
Definition: Darwin.h:589
llvm::DebuggerKind getDefaultDebuggerTuning() const override
Definition: Darwin.h:625
bool GetDefaultStandaloneDebug() const override
Definition: Darwin.h:624
Darwin - The base Darwin tool chain.
Definition: Darwin.h:287
VersionTuple TargetVersion
The native OS version we are targeting.
Definition: Darwin.h:315
bool isCrossCompiling() const override
Returns true if the toolchain is targeting a non-native architecture.
Definition: Darwin.h:539
LazyDetector< RocmInstallationDetector > RocmInstallation
Definition: Darwin.h:326
bool TargetInitialized
Whether the information on the target has been initialized.
Definition: Darwin.h:294
bool isIPhoneOSVersionLT(unsigned V0, unsigned V1=0, unsigned V2=0) const
Definition: Darwin.h:484
bool isKernelStatic() const override
On some iOS platforms, kernel and kernel modules were built statically.
Definition: Darwin.h:351
std::optional< DarwinSDKInfo > SDKInfo
The information about the darwin SDK that was used.
Definition: Darwin.h:320
bool isMacosxVersionLT(unsigned V0, unsigned V1=0, unsigned V2=0) const
Returns true if the minimum supported macOS version for the slice that's being built is less than the...
Definition: Darwin.h:494
bool UseObjCMixedDispatch() const override
UseObjCMixedDispatchDefault - When using non-legacy dispatch, should the mixed dispatch method be use...
Definition: Darwin.h:554
bool isTargetInitialized() const
Definition: Darwin.h:473
bool isTargetAppleSiliconMac() const
Definition: Darwin.h:468
LangOptions::StackProtectorMode GetDefaultStackProtectorLevel(bool KernelOrKext) const override
GetDefaultStackProtectorLevel - Get the default stack protector level for this tool chain.
Definition: Darwin.h:562
bool isTargetTvOSSimulator() const
Definition: Darwin.h:424
bool isTargetXROSSimulator() const
Definition: Darwin.h:413
LazyDetector< CudaInstallationDetector > CudaInstallation
Definition: Darwin.h:325
void setTarget(DarwinPlatformKind Platform, DarwinEnvironmentKind Environment, unsigned Major, unsigned Minor, unsigned Micro, VersionTuple NativeTargetVersion) const
Definition: Darwin.h:366
bool isTargetMacCatalyst() const
Definition: Darwin.h:454
bool isTargetWatchOSSimulator() const
Definition: Darwin.h:439
DarwinPlatformKind TargetPlatform
Definition: Darwin.h:311
bool isTargetWatchOSBased() const
Definition: Darwin.h:444
std::optional< llvm::Triple > TargetVariantTriple
The target variant triple that was specified (if any).
Definition: Darwin.h:323
VersionTuple getTripleTargetVersion() const
The version of the OS that's used by the OS specified in the target triple.
Definition: Darwin.h:479
bool isTargetIOSSimulator() const
Definition: Darwin.h:398
VersionTuple OSTargetVersion
The OS version we are targeting as specified in the triple.
Definition: Darwin.h:317
DarwinEnvironmentKind TargetEnvironment
Definition: Darwin.h:312
bool UseObjCMixedDispatch() const override
UseObjCMixedDispatchDefault - When using non-legacy dispatch, should the mixed dispatch method be use...
Definition: Darwin.h:253
bool isTargetIOSBased() const
Is the target either iOS or an iOS simulator?
Definition: Darwin.h:199
bool IsBlocksDefault() const override
IsBlocksDefault - Does this tool chain enable -fblocks by default.
Definition: Darwin.h:238
llvm::ExceptionHandling GetExceptionModel(const llvm::opt::ArgList &Args) const override
GetExceptionModel - Return the tool chain exception model.
Definition: Darwin.h:272
bool IsEncodeExtendedBlockSignatureDefault() const override
IsEncodeExtendedBlockSignatureDefault - Does this tool chain enable -fencode-extended-block-signature...
Definition: Darwin.h:246
void addProfileRTLibs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const override
Add any profiling runtime libraries that are needed.
Definition: Darwin.h:221
virtual void AddLinkARCArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
Add the linker arguments to link the ARC runtime library.
Definition: Darwin.h:172
virtual void addMinVersionArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
Definition: Darwin.h:187
virtual bool isKernelStatic() const
On some iOS platforms, kernel and kernel modules were built statically.
Definition: Darwin.h:196
virtual void addPlatformVersionArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
Definition: Darwin.h:190
virtual StringRef getOSLibraryNameSuffix(bool IgnoreSim=false) const
Definition: Darwin.h:276
virtual void addStartObjectFileArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
Definition: Darwin.h:183
RuntimeLibType GetDefaultRuntimeLibType() const override
GetDefaultRuntimeLibType - Get the default runtime library variant to use.
Definition: Darwin.h:258
bool IsObjCNonFragileABIDefault() const override
IsObjCNonFragileABIDefault - Does this tool chain set -fobjc-nonfragile-abi by default.
Definition: Darwin.h:248
RuntimeLinkOptions
Options to control how a runtime library is linked.
Definition: Darwin.h:202
bool IsMathErrnoDefault() const override
IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
Definition: Darwin.h:244
bool canSplitThinLTOUnit() const override
Returns true when it's possible to split LTO unit to use whole program devirtualization and CFI santi...
Definition: Darwin.h:282
Assembler(const ToolChain &TC)
Definition: Darwin.h:53
bool hasIntegratedCPP() const override
Definition: Darwin.h:56
bool isDsymutilJob() const override
Definition: Darwin.h:115
bool hasIntegratedCPP() const override
Definition: Darwin.h:114
Dsymutil(const ToolChain &TC)
Definition: Darwin.h:111
Linker(const ToolChain &TC)
Definition: Darwin.h:72
bool isLinkJob() const override
Definition: Darwin.h:75
bool hasIntegratedCPP() const override
Definition: Darwin.h:74
bool hasIntegratedCPP() const override
Definition: Darwin.h:101
Lipo(const ToolChain &TC)
Definition: Darwin.h:99
MachOTool(const char *Name, const char *ShortName, const ToolChain &TC)
Definition: Darwin.h:47
const toolchains::MachO & getMachOToolChain() const
Definition: Darwin.h:42
bool hasIntegratedCPP() const override
Definition: Darwin.h:88
StaticLibTool(const ToolChain &TC)
Definition: Darwin.h:85
VerifyDebug(const ToolChain &TC)
Definition: Darwin.h:125
bool hasIntegratedCPP() const override
Definition: Darwin.h:128
llvm::Triple::ArchType getArchTypeForMachOArchName(StringRef Str)
Definition: Darwin.cpp:42
void setTripleTypeForMachOArchName(llvm::Triple &T, StringRef Str, const llvm::opt::ArgList &Args)
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T