Darwin.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  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. #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_DARWIN_H
  9. #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_DARWIN_H
  10. #include "Cuda.h"
  11. #include "ROCm.h"
  12. #include "clang/Basic/DarwinSDKInfo.h"
  13. #include "clang/Basic/LangOptions.h"
  14. #include "clang/Driver/Tool.h"
  15. #include "clang/Driver/ToolChain.h"
  16. #include "clang/Driver/XRayArgs.h"
  17. namespace clang {
  18. namespace driver {
  19. namespace toolchains {
  20. class MachO;
  21. } // end namespace toolchains
  22. namespace tools {
  23. namespace darwin {
  24. llvm::Triple::ArchType getArchTypeForMachOArchName(StringRef Str);
  25. void setTripleTypeForMachOArchName(llvm::Triple &T, StringRef Str);
  26. class LLVM_LIBRARY_VISIBILITY MachOTool : public Tool {
  27. virtual void anchor();
  28. protected:
  29. void AddMachOArch(const llvm::opt::ArgList &Args,
  30. llvm::opt::ArgStringList &CmdArgs) const;
  31. const toolchains::MachO &getMachOToolChain() const {
  32. return reinterpret_cast<const toolchains::MachO &>(getToolChain());
  33. }
  34. public:
  35. MachOTool(const char *Name, const char *ShortName, const ToolChain &TC)
  36. : Tool(Name, ShortName, TC) {}
  37. };
  38. class LLVM_LIBRARY_VISIBILITY Assembler : public MachOTool {
  39. public:
  40. Assembler(const ToolChain &TC)
  41. : MachOTool("darwin::Assembler", "assembler", TC) {}
  42. bool hasIntegratedCPP() const override { return false; }
  43. void ConstructJob(Compilation &C, const JobAction &JA,
  44. const InputInfo &Output, const InputInfoList &Inputs,
  45. const llvm::opt::ArgList &TCArgs,
  46. const char *LinkingOutput) const override;
  47. };
  48. class LLVM_LIBRARY_VISIBILITY Linker : public MachOTool {
  49. bool NeedsTempPath(const InputInfoList &Inputs) const;
  50. void AddLinkArgs(Compilation &C, const llvm::opt::ArgList &Args,
  51. llvm::opt::ArgStringList &CmdArgs,
  52. const InputInfoList &Inputs, unsigned Version[5],
  53. bool LinkerIsLLD) const;
  54. public:
  55. Linker(const ToolChain &TC) : MachOTool("darwin::Linker", "linker", TC) {}
  56. bool hasIntegratedCPP() const override { return false; }
  57. bool isLinkJob() const override { return true; }
  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. class LLVM_LIBRARY_VISIBILITY StaticLibTool : public MachOTool {
  64. public:
  65. StaticLibTool(const ToolChain &TC)
  66. : MachOTool("darwin::StaticLibTool", "static-lib-linker", TC) {}
  67. bool hasIntegratedCPP() const override { return false; }
  68. bool isLinkJob() const override { return true; }
  69. void ConstructJob(Compilation &C, const JobAction &JA,
  70. const InputInfo &Output, const InputInfoList &Inputs,
  71. const llvm::opt::ArgList &TCArgs,
  72. const char *LinkingOutput) const override;
  73. };
  74. class LLVM_LIBRARY_VISIBILITY Lipo : public MachOTool {
  75. public:
  76. Lipo(const ToolChain &TC) : MachOTool("darwin::Lipo", "lipo", TC) {}
  77. bool hasIntegratedCPP() const override { return false; }
  78. void ConstructJob(Compilation &C, const JobAction &JA,
  79. const InputInfo &Output, const InputInfoList &Inputs,
  80. const llvm::opt::ArgList &TCArgs,
  81. const char *LinkingOutput) const override;
  82. };
  83. class LLVM_LIBRARY_VISIBILITY Dsymutil : public MachOTool {
  84. public:
  85. Dsymutil(const ToolChain &TC)
  86. : MachOTool("darwin::Dsymutil", "dsymutil", TC) {}
  87. bool hasIntegratedCPP() const override { return false; }
  88. bool isDsymutilJob() const override { return true; }
  89. void ConstructJob(Compilation &C, const JobAction &JA,
  90. const InputInfo &Output, const InputInfoList &Inputs,
  91. const llvm::opt::ArgList &TCArgs,
  92. const char *LinkingOutput) const override;
  93. };
  94. class LLVM_LIBRARY_VISIBILITY VerifyDebug : public MachOTool {
  95. public:
  96. VerifyDebug(const ToolChain &TC)
  97. : MachOTool("darwin::VerifyDebug", "dwarfdump", TC) {}
  98. bool hasIntegratedCPP() const override { return false; }
  99. void ConstructJob(Compilation &C, const JobAction &JA,
  100. const InputInfo &Output, const InputInfoList &Inputs,
  101. const llvm::opt::ArgList &TCArgs,
  102. const char *LinkingOutput) const override;
  103. };
  104. } // end namespace darwin
  105. } // end namespace tools
  106. namespace toolchains {
  107. class LLVM_LIBRARY_VISIBILITY MachO : public ToolChain {
  108. protected:
  109. Tool *buildAssembler() const override;
  110. Tool *buildLinker() const override;
  111. Tool *buildStaticLibTool() const override;
  112. Tool *getTool(Action::ActionClass AC) const override;
  113. private:
  114. mutable std::unique_ptr<tools::darwin::Lipo> Lipo;
  115. mutable std::unique_ptr<tools::darwin::Dsymutil> Dsymutil;
  116. mutable std::unique_ptr<tools::darwin::VerifyDebug> VerifyDebug;
  117. public:
  118. MachO(const Driver &D, const llvm::Triple &Triple,
  119. const llvm::opt::ArgList &Args);
  120. ~MachO() override;
  121. /// @name MachO specific toolchain API
  122. /// {
  123. /// Get the "MachO" arch name for a particular compiler invocation. For
  124. /// example, Apple treats different ARM variations as distinct architectures.
  125. StringRef getMachOArchName(const llvm::opt::ArgList &Args) const;
  126. /// Add the linker arguments to link the ARC runtime library.
  127. virtual void AddLinkARCArgs(const llvm::opt::ArgList &Args,
  128. llvm::opt::ArgStringList &CmdArgs) const {}
  129. /// Add the linker arguments to link the compiler runtime library.
  130. ///
  131. /// FIXME: This API is intended for use with embedded libraries only, and is
  132. /// misleadingly named.
  133. virtual void AddLinkRuntimeLibArgs(const llvm::opt::ArgList &Args,
  134. llvm::opt::ArgStringList &CmdArgs,
  135. bool ForceLinkBuiltinRT = false) const;
  136. virtual void addStartObjectFileArgs(const llvm::opt::ArgList &Args,
  137. llvm::opt::ArgStringList &CmdArgs) const {
  138. }
  139. virtual void addMinVersionArgs(const llvm::opt::ArgList &Args,
  140. llvm::opt::ArgStringList &CmdArgs) const {}
  141. virtual void addPlatformVersionArgs(const llvm::opt::ArgList &Args,
  142. llvm::opt::ArgStringList &CmdArgs) const {
  143. }
  144. /// On some iOS platforms, kernel and kernel modules were built statically. Is
  145. /// this such a target?
  146. virtual bool isKernelStatic() const { return false; }
  147. /// Is the target either iOS or an iOS simulator?
  148. bool isTargetIOSBased() const { return false; }
  149. /// Options to control how a runtime library is linked.
  150. enum RuntimeLinkOptions : unsigned {
  151. /// Link the library in even if it can't be found in the VFS.
  152. RLO_AlwaysLink = 1 << 0,
  153. /// Use the embedded runtime from the macho_embedded directory.
  154. RLO_IsEmbedded = 1 << 1,
  155. /// Emit rpaths for @executable_path as well as the resource directory.
  156. RLO_AddRPath = 1 << 2,
  157. };
  158. /// Add a runtime library to the list of items to link.
  159. void AddLinkRuntimeLib(const llvm::opt::ArgList &Args,
  160. llvm::opt::ArgStringList &CmdArgs, StringRef Component,
  161. RuntimeLinkOptions Opts = RuntimeLinkOptions(),
  162. bool IsShared = false) const;
  163. /// Add any profiling runtime libraries that are needed. This is essentially a
  164. /// MachO specific version of addProfileRT in Tools.cpp.
  165. void addProfileRTLibs(const llvm::opt::ArgList &Args,
  166. llvm::opt::ArgStringList &CmdArgs) const override {
  167. // There aren't any profiling libs for embedded targets currently.
  168. }
  169. /// }
  170. /// @name ToolChain Implementation
  171. /// {
  172. types::ID LookupTypeForExtension(StringRef Ext) const override;
  173. bool HasNativeLLVMSupport() const override;
  174. llvm::opt::DerivedArgList *
  175. TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
  176. Action::OffloadKind DeviceOffloadKind) const override;
  177. bool IsBlocksDefault() const override {
  178. // Always allow blocks on Apple; users interested in versioning are
  179. // expected to use /usr/include/Block.h.
  180. return true;
  181. }
  182. bool IsIntegratedAssemblerDefault() const override {
  183. // Default integrated assembler to on for Apple's MachO targets.
  184. return true;
  185. }
  186. bool IsMathErrnoDefault() const override { return false; }
  187. bool IsEncodeExtendedBlockSignatureDefault() const override { return true; }
  188. bool IsObjCNonFragileABIDefault() const override {
  189. // Non-fragile ABI is default for everything but i386.
  190. return getTriple().getArch() != llvm::Triple::x86;
  191. }
  192. bool UseObjCMixedDispatch() const override { return true; }
  193. bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override;
  194. RuntimeLibType GetDefaultRuntimeLibType() const override {
  195. return ToolChain::RLT_CompilerRT;
  196. }
  197. bool isPICDefault() const override;
  198. bool isPIEDefault(const llvm::opt::ArgList &Args) const override;
  199. bool isPICDefaultForced() const override;
  200. bool SupportsProfiling() const override;
  201. bool UseDwarfDebugFlags() const override;
  202. llvm::ExceptionHandling
  203. GetExceptionModel(const llvm::opt::ArgList &Args) const override {
  204. return llvm::ExceptionHandling::None;
  205. }
  206. virtual StringRef getOSLibraryNameSuffix(bool IgnoreSim = false) const {
  207. return "";
  208. }
  209. // Darwin toolchain uses legacy thin LTO API, which is not
  210. // capable of unit splitting.
  211. bool canSplitThinLTOUnit() const override { return false; }
  212. /// }
  213. };
  214. /// Darwin - The base Darwin tool chain.
  215. class LLVM_LIBRARY_VISIBILITY Darwin : public MachO {
  216. public:
  217. /// Whether the information on the target has been initialized.
  218. //
  219. // FIXME: This should be eliminated. What we want to do is make this part of
  220. // the "default target for arguments" selection process, once we get out of
  221. // the argument translation business.
  222. mutable bool TargetInitialized;
  223. enum DarwinPlatformKind {
  224. MacOS,
  225. IPhoneOS,
  226. TvOS,
  227. WatchOS,
  228. LastDarwinPlatform = WatchOS
  229. };
  230. enum DarwinEnvironmentKind {
  231. NativeEnvironment,
  232. Simulator,
  233. MacCatalyst,
  234. };
  235. mutable DarwinPlatformKind TargetPlatform;
  236. mutable DarwinEnvironmentKind TargetEnvironment;
  237. /// The native OS version we are targeting.
  238. mutable VersionTuple TargetVersion;
  239. /// The OS version we are targeting as specified in the triple.
  240. mutable VersionTuple OSTargetVersion;
  241. /// The information about the darwin SDK that was used.
  242. mutable Optional<DarwinSDKInfo> SDKInfo;
  243. CudaInstallationDetector CudaInstallation;
  244. RocmInstallationDetector RocmInstallation;
  245. private:
  246. void AddDeploymentTarget(llvm::opt::DerivedArgList &Args) const;
  247. public:
  248. Darwin(const Driver &D, const llvm::Triple &Triple,
  249. const llvm::opt::ArgList &Args);
  250. ~Darwin() override;
  251. std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args,
  252. types::ID InputType) const override;
  253. /// @name Apple Specific Toolchain Implementation
  254. /// {
  255. void addMinVersionArgs(const llvm::opt::ArgList &Args,
  256. llvm::opt::ArgStringList &CmdArgs) const override;
  257. void addPlatformVersionArgs(const llvm::opt::ArgList &Args,
  258. llvm::opt::ArgStringList &CmdArgs) const override;
  259. void addStartObjectFileArgs(const llvm::opt::ArgList &Args,
  260. llvm::opt::ArgStringList &CmdArgs) const override;
  261. bool isKernelStatic() const override {
  262. return (!(isTargetIPhoneOS() && !isIPhoneOSVersionLT(6, 0)) &&
  263. !isTargetWatchOS());
  264. }
  265. void addProfileRTLibs(const llvm::opt::ArgList &Args,
  266. llvm::opt::ArgStringList &CmdArgs) const override;
  267. protected:
  268. /// }
  269. /// @name Darwin specific Toolchain functions
  270. /// {
  271. // FIXME: Eliminate these ...Target functions and derive separate tool chains
  272. // for these targets and put version in constructor.
  273. void setTarget(DarwinPlatformKind Platform, DarwinEnvironmentKind Environment,
  274. unsigned Major, unsigned Minor, unsigned Micro,
  275. VersionTuple NativeTargetVersion) const {
  276. // FIXME: For now, allow reinitialization as long as values don't
  277. // change. This will go away when we move away from argument translation.
  278. if (TargetInitialized && TargetPlatform == Platform &&
  279. TargetEnvironment == Environment &&
  280. (Environment == MacCatalyst ? OSTargetVersion : TargetVersion) ==
  281. VersionTuple(Major, Minor, Micro))
  282. return;
  283. assert(!TargetInitialized && "Target already initialized!");
  284. TargetInitialized = true;
  285. TargetPlatform = Platform;
  286. TargetEnvironment = Environment;
  287. TargetVersion = VersionTuple(Major, Minor, Micro);
  288. if (Environment == Simulator)
  289. const_cast<Darwin *>(this)->setTripleEnvironment(llvm::Triple::Simulator);
  290. else if (Environment == MacCatalyst) {
  291. const_cast<Darwin *>(this)->setTripleEnvironment(llvm::Triple::MacABI);
  292. TargetVersion = NativeTargetVersion;
  293. OSTargetVersion = VersionTuple(Major, Minor, Micro);
  294. }
  295. }
  296. public:
  297. bool isTargetIPhoneOS() const {
  298. assert(TargetInitialized && "Target not initialized!");
  299. return (TargetPlatform == IPhoneOS || TargetPlatform == TvOS) &&
  300. TargetEnvironment == NativeEnvironment;
  301. }
  302. bool isTargetIOSSimulator() const {
  303. assert(TargetInitialized && "Target not initialized!");
  304. return (TargetPlatform == IPhoneOS || TargetPlatform == TvOS) &&
  305. TargetEnvironment == Simulator;
  306. }
  307. bool isTargetIOSBased() const {
  308. assert(TargetInitialized && "Target not initialized!");
  309. return isTargetIPhoneOS() || isTargetIOSSimulator();
  310. }
  311. bool isTargetTvOS() const {
  312. assert(TargetInitialized && "Target not initialized!");
  313. return TargetPlatform == TvOS && TargetEnvironment == NativeEnvironment;
  314. }
  315. bool isTargetTvOSSimulator() const {
  316. assert(TargetInitialized && "Target not initialized!");
  317. return TargetPlatform == TvOS && TargetEnvironment == Simulator;
  318. }
  319. bool isTargetTvOSBased() const {
  320. assert(TargetInitialized && "Target not initialized!");
  321. return TargetPlatform == TvOS;
  322. }
  323. bool isTargetWatchOS() const {
  324. assert(TargetInitialized && "Target not initialized!");
  325. return TargetPlatform == WatchOS && TargetEnvironment == NativeEnvironment;
  326. }
  327. bool isTargetWatchOSSimulator() const {
  328. assert(TargetInitialized && "Target not initialized!");
  329. return TargetPlatform == WatchOS && TargetEnvironment == Simulator;
  330. }
  331. bool isTargetWatchOSBased() const {
  332. assert(TargetInitialized && "Target not initialized!");
  333. return TargetPlatform == WatchOS;
  334. }
  335. bool isTargetMacCatalyst() const {
  336. return TargetPlatform == IPhoneOS && TargetEnvironment == MacCatalyst;
  337. }
  338. bool isTargetMacOS() const {
  339. assert(TargetInitialized && "Target not initialized!");
  340. return TargetPlatform == MacOS;
  341. }
  342. bool isTargetMacOSBased() const {
  343. assert(TargetInitialized && "Target not initialized!");
  344. return TargetPlatform == MacOS || isTargetMacCatalyst();
  345. }
  346. bool isTargetAppleSiliconMac() const {
  347. assert(TargetInitialized && "Target not initialized!");
  348. return isTargetMacOSBased() && getArch() == llvm::Triple::aarch64;
  349. }
  350. bool isTargetInitialized() const { return TargetInitialized; }
  351. /// The version of the OS that's used by the OS specified in the target
  352. /// triple. It might be different from the actual target OS on which the
  353. /// program will run, e.g. MacCatalyst code runs on a macOS target, but its
  354. /// target triple is iOS.
  355. VersionTuple getTripleTargetVersion() const {
  356. assert(TargetInitialized && "Target not initialized!");
  357. return isTargetMacCatalyst() ? OSTargetVersion : TargetVersion;
  358. }
  359. bool isIPhoneOSVersionLT(unsigned V0, unsigned V1 = 0,
  360. unsigned V2 = 0) const {
  361. assert(isTargetIOSBased() && "Unexpected call for non iOS target!");
  362. return TargetVersion < VersionTuple(V0, V1, V2);
  363. }
  364. /// Returns true if the minimum supported macOS version for the slice that's
  365. /// being built is less than the specified version. If there's no minimum
  366. /// supported macOS version, the deployment target version is compared to the
  367. /// specifed version instead.
  368. bool isMacosxVersionLT(unsigned V0, unsigned V1 = 0, unsigned V2 = 0) const {
  369. assert(isTargetMacOSBased() &&
  370. (getTriple().isMacOSX() || getTriple().isMacCatalystEnvironment()) &&
  371. "Unexpected call for non OS X target!");
  372. // The effective triple might not be initialized yet, so construct a
  373. // pseudo-effective triple to get the minimum supported OS version.
  374. VersionTuple MinVers =
  375. llvm::Triple(getTriple().getArchName(), "apple", "macos")
  376. .getMinimumSupportedOSVersion();
  377. return (!MinVers.empty() && MinVers > TargetVersion
  378. ? MinVers
  379. : TargetVersion) < VersionTuple(V0, V1, V2);
  380. }
  381. protected:
  382. /// Return true if c++17 aligned allocation/deallocation functions are not
  383. /// implemented in the c++ standard library of the deployment target we are
  384. /// targeting.
  385. bool isAlignedAllocationUnavailable() const;
  386. void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
  387. llvm::opt::ArgStringList &CC1Args,
  388. Action::OffloadKind DeviceOffloadKind) const override;
  389. StringRef getPlatformFamily() const;
  390. StringRef getOSLibraryNameSuffix(bool IgnoreSim = false) const override;
  391. public:
  392. static StringRef getSDKName(StringRef isysroot);
  393. /// }
  394. /// @name ToolChain Implementation
  395. /// {
  396. // Darwin tools support multiple architecture (e.g., i386 and x86_64) and
  397. // most development is done against SDKs, so compiling for a different
  398. // architecture should not get any special treatment.
  399. bool isCrossCompiling() const override { return false; }
  400. llvm::opt::DerivedArgList *
  401. TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
  402. Action::OffloadKind DeviceOffloadKind) const override;
  403. CXXStdlibType GetDefaultCXXStdlibType() const override;
  404. ObjCRuntime getDefaultObjCRuntime(bool isNonFragile) const override;
  405. bool hasBlocksRuntime() const override;
  406. void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs,
  407. llvm::opt::ArgStringList &CC1Args) const override;
  408. void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs,
  409. llvm::opt::ArgStringList &CC1Args) const override;
  410. bool UseObjCMixedDispatch() const override {
  411. // This is only used with the non-fragile ABI and non-legacy dispatch.
  412. // Mixed dispatch is used everywhere except OS X before 10.6.
  413. return !(isTargetMacOSBased() && isMacosxVersionLT(10, 6));
  414. }
  415. LangOptions::StackProtectorMode
  416. GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
  417. // Stack protectors default to on for user code on 10.5,
  418. // and for everything in 10.6 and beyond
  419. if (isTargetIOSBased() || isTargetWatchOSBased())
  420. return LangOptions::SSPOn;
  421. else if (isTargetMacOSBased() && !isMacosxVersionLT(10, 6))
  422. return LangOptions::SSPOn;
  423. else if (isTargetMacOSBased() && !isMacosxVersionLT(10, 5) && !KernelOrKext)
  424. return LangOptions::SSPOn;
  425. return LangOptions::SSPOff;
  426. }
  427. void CheckObjCARC() const override;
  428. llvm::ExceptionHandling GetExceptionModel(
  429. const llvm::opt::ArgList &Args) const override;
  430. bool SupportsEmbeddedBitcode() const override;
  431. SanitizerMask getSupportedSanitizers() const override;
  432. void printVerboseInfo(raw_ostream &OS) const override;
  433. };
  434. /// DarwinClang - The Darwin toolchain used by Clang.
  435. class LLVM_LIBRARY_VISIBILITY DarwinClang : public Darwin {
  436. public:
  437. DarwinClang(const Driver &D, const llvm::Triple &Triple,
  438. const llvm::opt::ArgList &Args);
  439. /// @name Apple ToolChain Implementation
  440. /// {
  441. RuntimeLibType GetRuntimeLibType(const llvm::opt::ArgList &Args) const override;
  442. void AddLinkRuntimeLibArgs(const llvm::opt::ArgList &Args,
  443. llvm::opt::ArgStringList &CmdArgs,
  444. bool ForceLinkBuiltinRT = false) const override;
  445. void AddClangCXXStdlibIncludeArgs(
  446. const llvm::opt::ArgList &DriverArgs,
  447. llvm::opt::ArgStringList &CC1Args) const override;
  448. void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
  449. llvm::opt::ArgStringList &CC1Args) const override;
  450. void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
  451. llvm::opt::ArgStringList &CmdArgs) const override;
  452. void AddCCKextLibArgs(const llvm::opt::ArgList &Args,
  453. llvm::opt::ArgStringList &CmdArgs) const override;
  454. void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const override;
  455. void AddLinkARCArgs(const llvm::opt::ArgList &Args,
  456. llvm::opt::ArgStringList &CmdArgs) const override;
  457. unsigned GetDefaultDwarfVersion() const override;
  458. // Until dtrace (via CTF) and LLDB can deal with distributed debug info,
  459. // Darwin defaults to standalone/full debug info.
  460. bool GetDefaultStandaloneDebug() const override { return true; }
  461. llvm::DebuggerKind getDefaultDebuggerTuning() const override {
  462. return llvm::DebuggerKind::LLDB;
  463. }
  464. /// }
  465. private:
  466. void AddLinkSanitizerLibArgs(const llvm::opt::ArgList &Args,
  467. llvm::opt::ArgStringList &CmdArgs,
  468. StringRef Sanitizer,
  469. bool shared = true) const;
  470. bool AddGnuCPlusPlusIncludePaths(const llvm::opt::ArgList &DriverArgs,
  471. llvm::opt::ArgStringList &CC1Args,
  472. llvm::SmallString<128> Base,
  473. llvm::StringRef Version,
  474. llvm::StringRef ArchDir,
  475. llvm::StringRef BitDir) const;
  476. llvm::StringRef GetHeaderSysroot(const llvm::opt::ArgList &DriverArgs) const;
  477. };
  478. } // end namespace toolchains
  479. } // end namespace driver
  480. } // end namespace clang
  481. #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_DARWIN_H