clang 20.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 // Return the full path of the compiler-rt library on a non-Darwin MachO
227 // system. Those are under
228 // <resourcedir>/lib/darwin/macho_embedded/<...>(.dylib|.a).
229 std::string
230 getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component,
231 FileType Type = ToolChain::FT_Static) const override;
232
233 /// }
234 /// @name ToolChain Implementation
235 /// {
236
237 types::ID LookupTypeForExtension(StringRef Ext) const override;
238
239 bool HasNativeLLVMSupport() const override;
240
241 llvm::opt::DerivedArgList *
242 TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
243 Action::OffloadKind DeviceOffloadKind) const override;
244
245 bool IsBlocksDefault() const override {
246 // Always allow blocks on Apple; users interested in versioning are
247 // expected to use /usr/include/Block.h.
248 return true;
249 }
250
251 bool IsMathErrnoDefault() const override { return false; }
252
253 bool IsEncodeExtendedBlockSignatureDefault() const override { return true; }
254
255 bool IsObjCNonFragileABIDefault() const override {
256 // Non-fragile ABI is default for everything but i386.
257 return getTriple().getArch() != llvm::Triple::x86;
258 }
259
260 bool UseObjCMixedDispatch() const override { return true; }
261
262 UnwindTableLevel
263 getDefaultUnwindTableLevel(const llvm::opt::ArgList &Args) const override;
264
266 return ToolChain::RLT_CompilerRT;
267 }
268
269 bool isPICDefault() const override;
270 bool isPIEDefault(const llvm::opt::ArgList &Args) const override;
271 bool isPICDefaultForced() const override;
272
273 bool SupportsProfiling() const override;
274
275 bool UseDwarfDebugFlags() const override;
276 std::string GetGlobalDebugPathRemapping() const override;
277
278 llvm::ExceptionHandling
279 GetExceptionModel(const llvm::opt::ArgList &Args) const override {
280 return llvm::ExceptionHandling::None;
281 }
282
283 virtual StringRef getOSLibraryNameSuffix(bool IgnoreSim = false) const {
284 return "";
285 }
286
287 // Darwin toolchain uses legacy thin LTO API, which is not
288 // capable of unit splitting.
289 bool canSplitThinLTOUnit() const override { return false; }
290 /// }
291};
292
293/// Darwin - The base Darwin tool chain.
294class LLVM_LIBRARY_VISIBILITY Darwin : public MachO {
295public:
296 /// Whether the information on the target has been initialized.
297 //
298 // FIXME: This should be eliminated. What we want to do is make this part of
299 // the "default target for arguments" selection process, once we get out of
300 // the argument translation business.
301 mutable bool TargetInitialized;
302
310 LastDarwinPlatform = XROS
311 };
316 };
317
320
321 /// The native OS version we are targeting.
322 mutable VersionTuple TargetVersion;
323 /// The OS version we are targeting as specified in the triple.
324 mutable VersionTuple OSTargetVersion;
325
326 /// The information about the darwin SDK that was used.
327 mutable std::optional<DarwinSDKInfo> SDKInfo;
328
329 /// The target variant triple that was specified (if any).
330 mutable std::optional<llvm::Triple> TargetVariantTriple;
331
334
335private:
336 void AddDeploymentTarget(llvm::opt::DerivedArgList &Args) const;
337
338public:
339 Darwin(const Driver &D, const llvm::Triple &Triple,
340 const llvm::opt::ArgList &Args);
341 ~Darwin() override;
342
343 std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args,
344 types::ID InputType) const override;
345
346 /// @name Apple Specific Toolchain Implementation
347 /// {
348
349 void addMinVersionArgs(const llvm::opt::ArgList &Args,
350 llvm::opt::ArgStringList &CmdArgs) const override;
351
352 void addPlatformVersionArgs(const llvm::opt::ArgList &Args,
353 llvm::opt::ArgStringList &CmdArgs) const override;
354
355 void addStartObjectFileArgs(const llvm::opt::ArgList &Args,
356 llvm::opt::ArgStringList &CmdArgs) const override;
357
358 bool isKernelStatic() const override {
359 return (!(isTargetIPhoneOS() && !isIPhoneOSVersionLT(6, 0)) &&
360 !isTargetWatchOS() && !isTargetDriverKit());
361 }
362
363 void addProfileRTLibs(const llvm::opt::ArgList &Args,
364 llvm::opt::ArgStringList &CmdArgs) const override;
365
366 // Return the full path of the compiler-rt library on a Darwin MachO system.
367 // Those are under <resourcedir>/lib/darwin/<...>(.dylib|.a).
368 std::string
369 getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component,
370 FileType Type = ToolChain::FT_Static) const override;
371
372protected:
373 /// }
374 /// @name Darwin specific Toolchain functions
375 /// {
376
377 // FIXME: Eliminate these ...Target functions and derive separate tool chains
378 // for these targets and put version in constructor.
380 unsigned Major, unsigned Minor, unsigned Micro,
381 VersionTuple NativeTargetVersion) const {
382 // FIXME: For now, allow reinitialization as long as values don't
383 // change. This will go away when we move away from argument translation.
384 if (TargetInitialized && TargetPlatform == Platform &&
385 TargetEnvironment == Environment &&
386 (Environment == MacCatalyst ? OSTargetVersion : TargetVersion) ==
387 VersionTuple(Major, Minor, Micro))
388 return;
389
390 assert(!TargetInitialized && "Target already initialized!");
391 TargetInitialized = true;
392 TargetPlatform = Platform;
393 TargetEnvironment = Environment;
394 TargetVersion = VersionTuple(Major, Minor, Micro);
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);
399 TargetVersion = NativeTargetVersion;
400 OSTargetVersion = VersionTuple(Major, Minor, Micro);
401 }
402 }
403
404public:
405 bool isTargetIPhoneOS() const {
406 assert(TargetInitialized && "Target not initialized!");
407 return (TargetPlatform == IPhoneOS || TargetPlatform == TvOS) &&
408 TargetEnvironment == NativeEnvironment;
409 }
410
411 bool isTargetIOSSimulator() const {
412 assert(TargetInitialized && "Target not initialized!");
413 return (TargetPlatform == IPhoneOS || TargetPlatform == TvOS) &&
414 TargetEnvironment == Simulator;
415 }
416
417 bool isTargetIOSBased() const {
418 assert(TargetInitialized && "Target not initialized!");
419 return isTargetIPhoneOS() || isTargetIOSSimulator();
420 }
421
422 bool isTargetXROSDevice() const {
423 return TargetPlatform == XROS && TargetEnvironment == NativeEnvironment;
424 }
425
427 return TargetPlatform == XROS && TargetEnvironment == Simulator;
428 }
429
430 bool isTargetXROS() const { return TargetPlatform == XROS; }
431
432 bool isTargetTvOS() const {
433 assert(TargetInitialized && "Target not initialized!");
434 return TargetPlatform == TvOS && TargetEnvironment == NativeEnvironment;
435 }
436
438 assert(TargetInitialized && "Target not initialized!");
439 return TargetPlatform == TvOS && TargetEnvironment == Simulator;
440 }
441
442 bool isTargetTvOSBased() const {
443 assert(TargetInitialized && "Target not initialized!");
444 return TargetPlatform == TvOS;
445 }
446
447 bool isTargetWatchOS() const {
448 assert(TargetInitialized && "Target not initialized!");
449 return TargetPlatform == WatchOS && TargetEnvironment == NativeEnvironment;
450 }
451
453 assert(TargetInitialized && "Target not initialized!");
454 return TargetPlatform == WatchOS && TargetEnvironment == Simulator;
455 }
456
457 bool isTargetWatchOSBased() const {
458 assert(TargetInitialized && "Target not initialized!");
459 return TargetPlatform == WatchOS;
460 }
461
462 bool isTargetDriverKit() const {
463 assert(TargetInitialized && "Target not initialized!");
464 return TargetPlatform == DriverKit;
465 }
466
467 bool isTargetMacCatalyst() const {
468 return TargetPlatform == IPhoneOS && TargetEnvironment == MacCatalyst;
469 }
470
471 bool isTargetMacOS() const {
472 assert(TargetInitialized && "Target not initialized!");
473 return TargetPlatform == MacOS;
474 }
475
476 bool isTargetMacOSBased() const {
477 assert(TargetInitialized && "Target not initialized!");
478 return TargetPlatform == MacOS || isTargetMacCatalyst();
479 }
480
482 assert(TargetInitialized && "Target not initialized!");
483 return isTargetMacOSBased() && getArch() == llvm::Triple::aarch64;
484 }
485
486 bool isTargetInitialized() const { return TargetInitialized; }
487
488 /// The version of the OS that's used by the OS specified in the target
489 /// triple. It might be different from the actual target OS on which the
490 /// program will run, e.g. MacCatalyst code runs on a macOS target, but its
491 /// target triple is iOS.
492 VersionTuple getTripleTargetVersion() const {
493 assert(TargetInitialized && "Target not initialized!");
494 return isTargetMacCatalyst() ? OSTargetVersion : TargetVersion;
495 }
496
497 bool isIPhoneOSVersionLT(unsigned V0, unsigned V1 = 0,
498 unsigned V2 = 0) const {
499 assert(isTargetIOSBased() && "Unexpected call for non iOS target!");
500 return TargetVersion < VersionTuple(V0, V1, V2);
501 }
502
503 /// Returns true if the minimum supported macOS version for the slice that's
504 /// being built is less than the specified version. If there's no minimum
505 /// supported macOS version, the deployment target version is compared to the
506 /// specifed version instead.
507 bool isMacosxVersionLT(unsigned V0, unsigned V1 = 0, unsigned V2 = 0) const {
508 assert(isTargetMacOSBased() &&
509 (getTriple().isMacOSX() || getTriple().isMacCatalystEnvironment()) &&
510 "Unexpected call for non OS X target!");
511 // The effective triple might not be initialized yet, so construct a
512 // pseudo-effective triple to get the minimum supported OS version.
513 VersionTuple MinVers =
514 llvm::Triple(getTriple().getArchName(), "apple", "macos")
515 .getMinimumSupportedOSVersion();
516 return (!MinVers.empty() && MinVers > TargetVersion
517 ? MinVers
518 : TargetVersion) < VersionTuple(V0, V1, V2);
519 }
520
521protected:
522 /// Return true if c++17 aligned allocation/deallocation functions are not
523 /// implemented in the c++ standard library of the deployment target we are
524 /// targeting.
525 bool isAlignedAllocationUnavailable() const;
526
527 /// Return true if c++14 sized deallocation functions are not implemented in
528 /// the c++ standard library of the deployment target we are targeting.
529 bool isSizedDeallocationUnavailable() const;
530
531 void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
532 llvm::opt::ArgStringList &CC1Args,
533 Action::OffloadKind DeviceOffloadKind) const override;
534
535 void addClangCC1ASTargetOptions(
536 const llvm::opt::ArgList &Args,
537 llvm::opt::ArgStringList &CC1ASArgs) const override;
538
539 StringRef getPlatformFamily() const;
540 StringRef getOSLibraryNameSuffix(bool IgnoreSim = false) const override;
541
542public:
543 static StringRef getSDKName(StringRef isysroot);
544
545 /// }
546 /// @name ToolChain Implementation
547 /// {
548
549 // Darwin tools support multiple architecture (e.g., i386 and x86_64) and
550 // most development is done against SDKs, so compiling for a different
551 // architecture should not get any special treatment.
552 bool isCrossCompiling() const override { return false; }
553
554 llvm::opt::DerivedArgList *
555 TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
556 Action::OffloadKind DeviceOffloadKind) const override;
557
558 CXXStdlibType GetDefaultCXXStdlibType() const override;
559 ObjCRuntime getDefaultObjCRuntime(bool isNonFragile) const override;
560 bool hasBlocksRuntime() const override;
561
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;
566
567 bool UseObjCMixedDispatch() const override {
568 // This is only used with the non-fragile ABI and non-legacy dispatch.
569
570 // Mixed dispatch is used everywhere except OS X before 10.6.
571 return !(isTargetMacOSBased() && isMacosxVersionLT(10, 6));
572 }
573
575 GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
576 // Stack protectors default to on for user code on 10.5,
577 // and for everything in 10.6 and beyond
578 if (isTargetIOSBased() || isTargetWatchOSBased() || isTargetDriverKit() ||
579 isTargetXROS())
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;
585
586 return LangOptions::SSPOff;
587 }
588
589 void CheckObjCARC() const override;
590
591 llvm::ExceptionHandling GetExceptionModel(
592 const llvm::opt::ArgList &Args) const override;
593
594 bool SupportsEmbeddedBitcode() const override;
595
596 SanitizerMask getSupportedSanitizers() const override;
597
598 void printVerboseInfo(raw_ostream &OS) const override;
599};
600
601/// DarwinClang - The Darwin toolchain used by Clang.
602class LLVM_LIBRARY_VISIBILITY DarwinClang : public Darwin {
603public:
604 DarwinClang(const Driver &D, const llvm::Triple &Triple,
605 const llvm::opt::ArgList &Args);
606
607 /// @name Apple ToolChain Implementation
608 /// {
609
610 RuntimeLibType GetRuntimeLibType(const llvm::opt::ArgList &Args) const override;
611
612 void AddLinkRuntimeLibArgs(const llvm::opt::ArgList &Args,
613 llvm::opt::ArgStringList &CmdArgs,
614 bool ForceLinkBuiltinRT = false) const override;
615
616 void AddClangCXXStdlibIncludeArgs(
617 const llvm::opt::ArgList &DriverArgs,
618 llvm::opt::ArgStringList &CC1Args) const override;
619
620 void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
621 llvm::opt::ArgStringList &CC1Args) const override;
622
623 void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
624 llvm::opt::ArgStringList &CmdArgs) const override;
625
626 void AddCCKextLibArgs(const llvm::opt::ArgList &Args,
627 llvm::opt::ArgStringList &CmdArgs) const override;
628
629 void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const override;
630
631 void AddLinkARCArgs(const llvm::opt::ArgList &Args,
632 llvm::opt::ArgStringList &CmdArgs) const override;
633
634 unsigned GetDefaultDwarfVersion() const override;
635 // Until dtrace (via CTF) and LLDB can deal with distributed debug info,
636 // Darwin defaults to standalone/full debug info.
637 bool GetDefaultStandaloneDebug() const override { return true; }
638 llvm::DebuggerKind getDefaultDebuggerTuning() const override {
639 return llvm::DebuggerKind::LLDB;
640 }
641
642 /// }
643
644private:
645 void AddLinkSanitizerLibArgs(const llvm::opt::ArgList &Args,
646 llvm::opt::ArgStringList &CmdArgs,
647 StringRef Sanitizer,
648 bool shared = true) const;
649
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;
656
658 GetEffectiveSysroot(const llvm::opt::ArgList &DriverArgs) const;
659};
660
661} // end namespace toolchains
662} // end namespace driver
663} // end namespace clang
664
665#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_DARWIN_H
const Decl * D
Defines the clang::LangOptions interface.
llvm::MachO::FileType FileType
Definition: MachO.h:46
int32_t ShortName
Definition: SemaARM.cpp:1146
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
The base class of the type hierarchy.
Definition: Type.h:1829
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:602
llvm::DebuggerKind getDefaultDebuggerTuning() const override
Definition: Darwin.h:638
bool GetDefaultStandaloneDebug() const override
Definition: Darwin.h:637
Darwin - The base Darwin tool chain.
Definition: Darwin.h:294
VersionTuple TargetVersion
The native OS version we are targeting.
Definition: Darwin.h:322
bool isCrossCompiling() const override
Returns true if the toolchain is targeting a non-native architecture.
Definition: Darwin.h:552
LazyDetector< RocmInstallationDetector > RocmInstallation
Definition: Darwin.h:333
bool TargetInitialized
Whether the information on the target has been initialized.
Definition: Darwin.h:301
bool isIPhoneOSVersionLT(unsigned V0, unsigned V1=0, unsigned V2=0) const
Definition: Darwin.h:497
bool isKernelStatic() const override
On some iOS platforms, kernel and kernel modules were built statically.
Definition: Darwin.h:358
std::optional< DarwinSDKInfo > SDKInfo
The information about the darwin SDK that was used.
Definition: Darwin.h:327
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:507
bool UseObjCMixedDispatch() const override
UseObjCMixedDispatchDefault - When using non-legacy dispatch, should the mixed dispatch method be use...
Definition: Darwin.h:567
bool isTargetInitialized() const
Definition: Darwin.h:486
bool isTargetAppleSiliconMac() const
Definition: Darwin.h:481
LangOptions::StackProtectorMode GetDefaultStackProtectorLevel(bool KernelOrKext) const override
GetDefaultStackProtectorLevel - Get the default stack protector level for this tool chain.
Definition: Darwin.h:575
bool isTargetTvOSSimulator() const
Definition: Darwin.h:437
bool isTargetXROSSimulator() const
Definition: Darwin.h:426
LazyDetector< CudaInstallationDetector > CudaInstallation
Definition: Darwin.h:332
void setTarget(DarwinPlatformKind Platform, DarwinEnvironmentKind Environment, unsigned Major, unsigned Minor, unsigned Micro, VersionTuple NativeTargetVersion) const
Definition: Darwin.h:379
bool isTargetMacCatalyst() const
Definition: Darwin.h:467
bool isTargetWatchOSSimulator() const
Definition: Darwin.h:452
DarwinPlatformKind TargetPlatform
Definition: Darwin.h:318
bool isTargetWatchOSBased() const
Definition: Darwin.h:457
std::optional< llvm::Triple > TargetVariantTriple
The target variant triple that was specified (if any).
Definition: Darwin.h:330
VersionTuple getTripleTargetVersion() const
The version of the OS that's used by the OS specified in the target triple.
Definition: Darwin.h:492
bool isTargetIOSSimulator() const
Definition: Darwin.h:411
VersionTuple OSTargetVersion
The OS version we are targeting as specified in the triple.
Definition: Darwin.h:324
DarwinEnvironmentKind TargetEnvironment
Definition: Darwin.h:319
bool UseObjCMixedDispatch() const override
UseObjCMixedDispatchDefault - When using non-legacy dispatch, should the mixed dispatch method be use...
Definition: Darwin.h:260
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:245
llvm::ExceptionHandling GetExceptionModel(const llvm::opt::ArgList &Args) const override
GetExceptionModel - Return the tool chain exception model.
Definition: Darwin.h:279
bool IsEncodeExtendedBlockSignatureDefault() const override
IsEncodeExtendedBlockSignatureDefault - Does this tool chain enable -fencode-extended-block-signature...
Definition: Darwin.h:253
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:283
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:265
bool IsObjCNonFragileABIDefault() const override
IsObjCNonFragileABIDefault - Does this tool chain set -fobjc-nonfragile-abi by default.
Definition: Darwin.h:255
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:251
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:289
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