clang  15.0.0git
ToolChain.cpp
Go to the documentation of this file.
1 //===- ToolChain.cpp - Collections of tools for one platform --------------===//
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 
10 #include "ToolChains/Arch/ARM.h"
11 #include "ToolChains/Clang.h"
12 #include "ToolChains/Flang.h"
15 #include "clang/Basic/Sanitizers.h"
16 #include "clang/Config/config.h"
17 #include "clang/Driver/Action.h"
18 #include "clang/Driver/Driver.h"
20 #include "clang/Driver/InputInfo.h"
21 #include "clang/Driver/Job.h"
22 #include "clang/Driver/Options.h"
24 #include "clang/Driver/XRayArgs.h"
25 #include "llvm/ADT/STLExtras.h"
26 #include "llvm/ADT/SmallString.h"
27 #include "llvm/ADT/StringRef.h"
28 #include "llvm/ADT/Triple.h"
29 #include "llvm/ADT/Twine.h"
30 #include "llvm/Config/llvm-config.h"
31 #include "llvm/MC/MCTargetOptions.h"
32 #include "llvm/MC/TargetRegistry.h"
33 #include "llvm/Option/Arg.h"
34 #include "llvm/Option/ArgList.h"
35 #include "llvm/Option/OptTable.h"
36 #include "llvm/Option/Option.h"
37 #include "llvm/Support/ErrorHandling.h"
38 #include "llvm/Support/FileSystem.h"
39 #include "llvm/Support/Path.h"
40 #include "llvm/Support/TargetParser.h"
41 #include "llvm/Support/VersionTuple.h"
42 #include "llvm/Support/VirtualFileSystem.h"
43 #include <cassert>
44 #include <cstddef>
45 #include <cstring>
46 #include <string>
47 
48 using namespace clang;
49 using namespace driver;
50 using namespace tools;
51 using namespace llvm;
52 using namespace llvm::opt;
53 
54 static llvm::opt::Arg *GetRTTIArgument(const ArgList &Args) {
55  return Args.getLastArg(options::OPT_mkernel, options::OPT_fapple_kext,
56  options::OPT_fno_rtti, options::OPT_frtti);
57 }
58 
59 static ToolChain::RTTIMode CalculateRTTIMode(const ArgList &Args,
60  const llvm::Triple &Triple,
61  const Arg *CachedRTTIArg) {
62  // Explicit rtti/no-rtti args
63  if (CachedRTTIArg) {
64  if (CachedRTTIArg->getOption().matches(options::OPT_frtti))
65  return ToolChain::RM_Enabled;
66  else
68  }
69 
70  // -frtti is default, except for the PS4/PS5 and DriverKit.
71  bool NoRTTI = Triple.isPS() || Triple.isDriverKit();
73 }
74 
75 ToolChain::ToolChain(const Driver &D, const llvm::Triple &T,
76  const ArgList &Args)
77  : D(D), Triple(T), Args(Args), CachedRTTIArg(GetRTTIArgument(Args)),
78  CachedRTTIMode(CalculateRTTIMode(Args, Triple, CachedRTTIArg)) {
79  auto addIfExists = [this](path_list &List, const std::string &Path) {
80  if (getVFS().exists(Path))
81  List.push_back(Path);
82  };
83 
84  for (const auto &Path : getRuntimePaths())
85  addIfExists(getLibraryPaths(), Path);
86  for (const auto &Path : getStdlibPaths())
87  addIfExists(getFilePaths(), Path);
88  addIfExists(getFilePaths(), getArchSpecificLibPath());
89 }
90 
91 void ToolChain::setTripleEnvironment(llvm::Triple::EnvironmentType Env) {
92  Triple.setEnvironment(Env);
93  if (EffectiveTriple != llvm::Triple())
94  EffectiveTriple.setEnvironment(Env);
95 }
96 
97 ToolChain::~ToolChain() = default;
98 
99 llvm::vfs::FileSystem &ToolChain::getVFS() const {
100  return getDriver().getVFS();
101 }
102 
104  return Args.hasFlag(options::OPT_fintegrated_as,
105  options::OPT_fno_integrated_as,
107 }
108 
110  assert(
113  "(Non-)integrated backend set incorrectly!");
114 
115  bool IBackend = Args.hasFlag(options::OPT_fintegrated_objemitter,
116  options::OPT_fno_integrated_objemitter,
118 
119  // Diagnose when integrated-objemitter options are not supported by this
120  // toolchain.
121  unsigned DiagID;
122  if ((IBackend && !IsIntegratedBackendSupported()) ||
123  (!IBackend && !IsNonIntegratedBackendSupported()))
124  DiagID = clang::diag::err_drv_unsupported_opt_for_target;
125  else
126  DiagID = clang::diag::warn_drv_unsupported_opt_for_target;
127  Arg *A = Args.getLastArg(options::OPT_fno_integrated_objemitter);
129  D.Diag(DiagID) << A->getAsString(Args) << Triple.getTriple();
130  A = Args.getLastArg(options::OPT_fintegrated_objemitter);
131  if (A && !IsIntegratedBackendSupported())
132  D.Diag(DiagID) << A->getAsString(Args) << Triple.getTriple();
133 
134  return IBackend;
135 }
136 
138  return ENABLE_X86_RELAX_RELOCATIONS;
139 }
140 
142  return PPC_LINUX_DEFAULT_IEEELONGDOUBLE && getTriple().isOSLinux();
143 }
144 
146 ToolChain::getSanitizerArgs(const llvm::opt::ArgList &JobArgs) const {
147  SanitizerArgs SanArgs(*this, JobArgs, !SanitizerArgsChecked);
148  SanitizerArgsChecked = true;
149  return SanArgs;
150 }
151 
153  if (!XRayArguments.get())
154  XRayArguments.reset(new XRayArgs(*this, Args));
155  return *XRayArguments.get();
156 }
157 
158 namespace {
159 
160 struct DriverSuffix {
161  const char *Suffix;
162  const char *ModeFlag;
163 };
164 
165 } // namespace
166 
167 static const DriverSuffix *FindDriverSuffix(StringRef ProgName, size_t &Pos) {
168  // A list of known driver suffixes. Suffixes are compared against the
169  // program name in order. If there is a match, the frontend type is updated as
170  // necessary by applying the ModeFlag.
171  static const DriverSuffix DriverSuffixes[] = {
172  {"clang", nullptr},
173  {"clang++", "--driver-mode=g++"},
174  {"clang-c++", "--driver-mode=g++"},
175  {"clang-cc", nullptr},
176  {"clang-cpp", "--driver-mode=cpp"},
177  {"clang-g++", "--driver-mode=g++"},
178  {"clang-gcc", nullptr},
179  {"clang-cl", "--driver-mode=cl"},
180  {"cc", nullptr},
181  {"cpp", "--driver-mode=cpp"},
182  {"cl", "--driver-mode=cl"},
183  {"++", "--driver-mode=g++"},
184  {"flang", "--driver-mode=flang"},
185  {"clang-dxc", "--driver-mode=dxc"},
186  };
187 
188  for (size_t i = 0; i < llvm::array_lengthof(DriverSuffixes); ++i) {
189  StringRef Suffix(DriverSuffixes[i].Suffix);
190  if (ProgName.endswith(Suffix)) {
191  Pos = ProgName.size() - Suffix.size();
192  return &DriverSuffixes[i];
193  }
194  }
195  return nullptr;
196 }
197 
198 /// Normalize the program name from argv[0] by stripping the file extension if
199 /// present and lower-casing the string on Windows.
200 static std::string normalizeProgramName(llvm::StringRef Argv0) {
201  std::string ProgName = std::string(llvm::sys::path::stem(Argv0));
202  if (is_style_windows(llvm::sys::path::Style::native)) {
203  // Transform to lowercase for case insensitive file systems.
204  std::transform(ProgName.begin(), ProgName.end(), ProgName.begin(),
205  ::tolower);
206  }
207  return ProgName;
208 }
209 
210 static const DriverSuffix *parseDriverSuffix(StringRef ProgName, size_t &Pos) {
211  // Try to infer frontend type and default target from the program name by
212  // comparing it against DriverSuffixes in order.
213 
214  // If there is a match, the function tries to identify a target as prefix.
215  // E.g. "x86_64-linux-clang" as interpreted as suffix "clang" with target
216  // prefix "x86_64-linux". If such a target prefix is found, it may be
217  // added via -target as implicit first argument.
218  const DriverSuffix *DS = FindDriverSuffix(ProgName, Pos);
219 
220  if (!DS) {
221  // Try again after stripping any trailing version number:
222  // clang++3.5 -> clang++
223  ProgName = ProgName.rtrim("0123456789.");
224  DS = FindDriverSuffix(ProgName, Pos);
225  }
226 
227  if (!DS) {
228  // Try again after stripping trailing -component.
229  // clang++-tot -> clang++
230  ProgName = ProgName.slice(0, ProgName.rfind('-'));
231  DS = FindDriverSuffix(ProgName, Pos);
232  }
233  return DS;
234 }
235 
238  std::string ProgName = normalizeProgramName(PN);
239  size_t SuffixPos;
240  const DriverSuffix *DS = parseDriverSuffix(ProgName, SuffixPos);
241  if (!DS)
242  return {};
243  size_t SuffixEnd = SuffixPos + strlen(DS->Suffix);
244 
245  size_t LastComponent = ProgName.rfind('-', SuffixPos);
246  if (LastComponent == std::string::npos)
247  return ParsedClangName(ProgName.substr(0, SuffixEnd), DS->ModeFlag);
248  std::string ModeSuffix = ProgName.substr(LastComponent + 1,
249  SuffixEnd - LastComponent - 1);
250 
251  // Infer target from the prefix.
252  StringRef Prefix(ProgName);
253  Prefix = Prefix.slice(0, LastComponent);
254  std::string IgnoredError;
255  bool IsRegistered =
256  llvm::TargetRegistry::lookupTarget(std::string(Prefix), IgnoredError);
257  return ParsedClangName{std::string(Prefix), ModeSuffix, DS->ModeFlag,
258  IsRegistered};
259 }
260 
262  // In universal driver terms, the arch name accepted by -arch isn't exactly
263  // the same as the ones that appear in the triple. Roughly speaking, this is
264  // an inverse of the darwin::getArchTypeForDarwinArchName() function.
265  switch (Triple.getArch()) {
266  case llvm::Triple::aarch64: {
267  if (getTriple().isArm64e())
268  return "arm64e";
269  return "arm64";
270  }
271  case llvm::Triple::aarch64_32:
272  return "arm64_32";
273  case llvm::Triple::ppc:
274  return "ppc";
275  case llvm::Triple::ppcle:
276  return "ppcle";
277  case llvm::Triple::ppc64:
278  return "ppc64";
279  case llvm::Triple::ppc64le:
280  return "ppc64le";
281  default:
282  return Triple.getArchName();
283  }
284 }
285 
287  return Input.getFilename();
288 }
289 
290 bool ToolChain::IsUnwindTablesDefault(const ArgList &Args) const {
291  return false;
292 }
293 
294 Tool *ToolChain::getClang() const {
295  if (!Clang)
296  Clang.reset(new tools::Clang(*this, useIntegratedBackend()));
297  return Clang.get();
298 }
299 
300 Tool *ToolChain::getFlang() const {
301  if (!Flang)
302  Flang.reset(new tools::Flang(*this));
303  return Flang.get();
304 }
305 
307  return new tools::ClangAs(*this);
308 }
309 
311  llvm_unreachable("Linking is not supported by this toolchain");
312 }
313 
315  llvm_unreachable("Creating static lib is not supported by this toolchain");
316 }
317 
318 Tool *ToolChain::getAssemble() const {
319  if (!Assemble)
320  Assemble.reset(buildAssembler());
321  return Assemble.get();
322 }
323 
324 Tool *ToolChain::getClangAs() const {
325  if (!Assemble)
326  Assemble.reset(new tools::ClangAs(*this));
327  return Assemble.get();
328 }
329 
330 Tool *ToolChain::getLink() const {
331  if (!Link)
332  Link.reset(buildLinker());
333  return Link.get();
334 }
335 
336 Tool *ToolChain::getStaticLibTool() const {
337  if (!StaticLibTool)
338  StaticLibTool.reset(buildStaticLibTool());
339  return StaticLibTool.get();
340 }
341 
342 Tool *ToolChain::getIfsMerge() const {
343  if (!IfsMerge)
344  IfsMerge.reset(new tools::ifstool::Merger(*this));
345  return IfsMerge.get();
346 }
347 
348 Tool *ToolChain::getOffloadBundler() const {
349  if (!OffloadBundler)
350  OffloadBundler.reset(new tools::OffloadBundler(*this));
351  return OffloadBundler.get();
352 }
353 
354 Tool *ToolChain::getOffloadWrapper() const {
355  if (!OffloadWrapper)
356  OffloadWrapper.reset(new tools::OffloadWrapper(*this));
357  return OffloadWrapper.get();
358 }
359 
360 Tool *ToolChain::getOffloadPackager() const {
361  if (!OffloadPackager)
362  OffloadPackager.reset(new tools::OffloadPackager(*this));
363  return OffloadPackager.get();
364 }
365 
366 Tool *ToolChain::getLinkerWrapper() const {
367  if (!LinkerWrapper)
368  LinkerWrapper.reset(new tools::LinkerWrapper(*this, getLink()));
369  return LinkerWrapper.get();
370 }
371 
373  switch (AC) {
375  return getAssemble();
376 
378  return getIfsMerge();
379 
381  return getLink();
382 
384  return getStaticLibTool();
385 
386  case Action::InputClass:
392  llvm_unreachable("Invalid tool kind.");
393 
403  return getClang();
404 
407  return getOffloadBundler();
408 
410  return getOffloadWrapper();
412  return getOffloadPackager();
414  return getLinkerWrapper();
415  }
416 
417  llvm_unreachable("Invalid tool kind.");
418 }
419 
420 static StringRef getArchNameForCompilerRTLib(const ToolChain &TC,
421  const ArgList &Args) {
422  const llvm::Triple &Triple = TC.getTriple();
423  bool IsWindows = Triple.isOSWindows();
424 
425  if (TC.getArch() == llvm::Triple::arm || TC.getArch() == llvm::Triple::armeb)
426  return (arm::getARMFloatABI(TC, Args) == arm::FloatABI::Hard && !IsWindows)
427  ? "armhf"
428  : "arm";
429 
430  // For historic reasons, Android library is using i686 instead of i386.
431  if (TC.getArch() == llvm::Triple::x86 && Triple.isAndroid())
432  return "i686";
433 
434  if (TC.getArch() == llvm::Triple::x86_64 && Triple.isX32())
435  return "x32";
436 
437  return llvm::Triple::getArchTypeName(TC.getArch());
438 }
439 
440 StringRef ToolChain::getOSLibName() const {
441  if (Triple.isOSDarwin())
442  return "darwin";
443 
444  switch (Triple.getOS()) {
445  case llvm::Triple::FreeBSD:
446  return "freebsd";
447  case llvm::Triple::NetBSD:
448  return "netbsd";
449  case llvm::Triple::OpenBSD:
450  return "openbsd";
451  case llvm::Triple::Solaris:
452  return "sunos";
453  case llvm::Triple::AIX:
454  return "aix";
455  default:
456  return getOS();
457  }
458 }
459 
461  SmallString<128> Path(getDriver().ResourceDir);
462  if (Triple.isOSUnknown()) {
463  llvm::sys::path::append(Path, "lib");
464  } else {
465  llvm::sys::path::append(Path, "lib", getOSLibName());
466  }
467  return std::string(Path.str());
468 }
469 
471  StringRef Component,
472  FileType Type) const {
473  std::string CRTAbsolutePath = getCompilerRT(Args, Component, Type);
474  return llvm::sys::path::filename(CRTAbsolutePath).str();
475 }
476 
477 std::string ToolChain::buildCompilerRTBasename(const llvm::opt::ArgList &Args,
478  StringRef Component,
479  FileType Type,
480  bool AddArch) const {
481  const llvm::Triple &TT = getTriple();
482  bool IsITANMSVCWindows =
483  TT.isWindowsMSVCEnvironment() || TT.isWindowsItaniumEnvironment();
484 
485  const char *Prefix =
486  IsITANMSVCWindows || Type == ToolChain::FT_Object ? "" : "lib";
487  const char *Suffix;
488  switch (Type) {
490  Suffix = IsITANMSVCWindows ? ".obj" : ".o";
491  break;
493  Suffix = IsITANMSVCWindows ? ".lib" : ".a";
494  break;
496  Suffix = TT.isOSWindows()
497  ? (TT.isWindowsGNUEnvironment() ? ".dll.a" : ".lib")
498  : ".so";
499  break;
500  }
501 
502  std::string ArchAndEnv;
503  if (AddArch) {
504  StringRef Arch = getArchNameForCompilerRTLib(*this, Args);
505  const char *Env = TT.isAndroid() ? "-android" : "";
506  ArchAndEnv = ("-" + Arch + Env).str();
507  }
508  return (Prefix + Twine("clang_rt.") + Component + ArchAndEnv + Suffix).str();
509 }
510 
511 std::string ToolChain::getCompilerRT(const ArgList &Args, StringRef Component,
512  FileType Type) const {
513  // Check for runtime files in the new layout without the architecture first.
514  std::string CRTBasename =
515  buildCompilerRTBasename(Args, Component, Type, /*AddArch=*/false);
516  for (const auto &LibPath : getLibraryPaths()) {
517  SmallString<128> P(LibPath);
518  llvm::sys::path::append(P, CRTBasename);
519  if (getVFS().exists(P))
520  return std::string(P.str());
521  }
522 
523  // Fall back to the old expected compiler-rt name if the new one does not
524  // exist.
525  CRTBasename =
526  buildCompilerRTBasename(Args, Component, Type, /*AddArch=*/true);
528  llvm::sys::path::append(Path, CRTBasename);
529  return std::string(Path.str());
530 }
531 
532 const char *ToolChain::getCompilerRTArgString(const llvm::opt::ArgList &Args,
533  StringRef Component,
534  FileType Type) const {
535  return Args.MakeArgString(getCompilerRT(Args, Component, Type));
536 }
537 
539  path_list Paths;
540  auto addPathForTriple = [this, &Paths](const llvm::Triple &Triple) {
542  llvm::sys::path::append(P, "lib", Triple.str());
543  Paths.push_back(std::string(P.str()));
544  };
545 
546  addPathForTriple(getTriple());
547 
548  // Android targets may include an API level at the end. We still want to fall
549  // back on a path without the API level.
550  if (getTriple().isAndroid() &&
551  getTriple().getEnvironmentName() != "android") {
552  llvm::Triple TripleWithoutLevel = getTriple();
553  TripleWithoutLevel.setEnvironmentName("android");
554  addPathForTriple(TripleWithoutLevel);
555  }
556 
557  return Paths;
558 }
559 
561  path_list Paths;
563  llvm::sys::path::append(P, "..", "lib", getTripleString());
564  Paths.push_back(std::string(P.str()));
565 
566  return Paths;
567 }
568 
570  SmallString<128> Path(getDriver().ResourceDir);
571  llvm::sys::path::append(Path, "lib", getOSLibName(),
572  llvm::Triple::getArchTypeName(getArch()));
573  return std::string(Path.str());
574 }
575 
576 bool ToolChain::needsProfileRT(const ArgList &Args) {
577  if (Args.hasArg(options::OPT_noprofilelib))
578  return false;
579 
580  return Args.hasArg(options::OPT_fprofile_generate) ||
581  Args.hasArg(options::OPT_fprofile_generate_EQ) ||
582  Args.hasArg(options::OPT_fcs_profile_generate) ||
583  Args.hasArg(options::OPT_fcs_profile_generate_EQ) ||
584  Args.hasArg(options::OPT_fprofile_instr_generate) ||
585  Args.hasArg(options::OPT_fprofile_instr_generate_EQ) ||
586  Args.hasArg(options::OPT_fcreate_profile) ||
587  Args.hasArg(options::OPT_forder_file_instrumentation);
588 }
589 
590 bool ToolChain::needsGCovInstrumentation(const llvm::opt::ArgList &Args) {
591  return Args.hasArg(options::OPT_coverage) ||
592  Args.hasFlag(options::OPT_fprofile_arcs, options::OPT_fno_profile_arcs,
593  false);
594 }
595 
597  if (D.IsFlangMode() && getDriver().ShouldUseFlangCompiler(JA)) return getFlang();
598  if (getDriver().ShouldUseClangCompiler(JA)) return getClang();
599  Action::ActionClass AC = JA.getKind();
601  return getClangAs();
602  return getTool(AC);
603 }
604 
605 std::string ToolChain::GetFilePath(const char *Name) const {
606  return D.GetFilePath(Name, *this);
607 }
608 
609 std::string ToolChain::GetProgramPath(const char *Name) const {
610  return D.GetProgramPath(Name, *this);
611 }
612 
613 std::string ToolChain::GetLinkerPath(bool *LinkerIsLLD) const {
614  if (LinkerIsLLD)
615  *LinkerIsLLD = false;
616 
617  // Get -fuse-ld= first to prevent -Wunused-command-line-argument. -fuse-ld= is
618  // considered as the linker flavor, e.g. "bfd", "gold", or "lld".
619  const Arg* A = Args.getLastArg(options::OPT_fuse_ld_EQ);
620  StringRef UseLinker = A ? A->getValue() : CLANG_DEFAULT_LINKER;
621 
622  // --ld-path= takes precedence over -fuse-ld= and specifies the executable
623  // name. -B, COMPILER_PATH and PATH and consulted if the value does not
624  // contain a path component separator.
625  if (const Arg *A = Args.getLastArg(options::OPT_ld_path_EQ)) {
626  std::string Path(A->getValue());
627  if (!Path.empty()) {
628  if (llvm::sys::path::parent_path(Path).empty())
629  Path = GetProgramPath(A->getValue());
630  if (llvm::sys::fs::can_execute(Path))
631  return std::string(Path);
632  }
633  getDriver().Diag(diag::err_drv_invalid_linker_name) << A->getAsString(Args);
635  }
636  // If we're passed -fuse-ld= with no argument, or with the argument ld,
637  // then use whatever the default system linker is.
638  if (UseLinker.empty() || UseLinker == "ld") {
639  const char *DefaultLinker = getDefaultLinker();
640  if (llvm::sys::path::is_absolute(DefaultLinker))
641  return std::string(DefaultLinker);
642  else
643  return GetProgramPath(DefaultLinker);
644  }
645 
646  // Extending -fuse-ld= to an absolute or relative path is unexpected. Checking
647  // for the linker flavor is brittle. In addition, prepending "ld." or "ld64."
648  // to a relative path is surprising. This is more complex due to priorities
649  // among -B, COMPILER_PATH and PATH. --ld-path= should be used instead.
650  if (UseLinker.contains('/'))
651  getDriver().Diag(diag::warn_drv_fuse_ld_path);
652 
653  if (llvm::sys::path::is_absolute(UseLinker)) {
654  // If we're passed what looks like an absolute path, don't attempt to
655  // second-guess that.
656  if (llvm::sys::fs::can_execute(UseLinker))
657  return std::string(UseLinker);
658  } else {
659  llvm::SmallString<8> LinkerName;
660  if (Triple.isOSDarwin())
661  LinkerName.append("ld64.");
662  else
663  LinkerName.append("ld.");
664  LinkerName.append(UseLinker);
665 
666  std::string LinkerPath(GetProgramPath(LinkerName.c_str()));
667  if (llvm::sys::fs::can_execute(LinkerPath)) {
668  if (LinkerIsLLD)
669  *LinkerIsLLD = UseLinker == "lld";
670  return LinkerPath;
671  }
672  }
673 
674  if (A)
675  getDriver().Diag(diag::err_drv_invalid_linker_name) << A->getAsString(Args);
676 
678 }
679 
681  // TODO: Add support for static lib archiving on Windows
682  if (Triple.isOSDarwin())
683  return GetProgramPath("libtool");
684  return GetProgramPath("llvm-ar");
685 }
686 
689 
690  // Flang always runs the preprocessor and has no notion of "preprocessed
691  // fortran". Here, TY_PP_Fortran is coerced to TY_Fortran to avoid treating
692  // them differently.
693  if (D.IsFlangMode() && id == types::TY_PP_Fortran)
694  id = types::TY_Fortran;
695 
696  return id;
697 }
698 
700  return false;
701 }
702 
704  llvm::Triple HostTriple(LLVM_HOST_TRIPLE);
705  switch (HostTriple.getArch()) {
706  // The A32/T32/T16 instruction sets are not separate architectures in this
707  // context.
708  case llvm::Triple::arm:
709  case llvm::Triple::armeb:
710  case llvm::Triple::thumb:
711  case llvm::Triple::thumbeb:
712  return getArch() != llvm::Triple::arm && getArch() != llvm::Triple::thumb &&
713  getArch() != llvm::Triple::armeb && getArch() != llvm::Triple::thumbeb;
714  default:
715  return HostTriple.getArch() != getArch();
716  }
717 }
718 
720  return ObjCRuntime(isNonFragile ? ObjCRuntime::GNUstep : ObjCRuntime::GCC,
721  VersionTuple());
722 }
723 
724 llvm::ExceptionHandling
725 ToolChain::GetExceptionModel(const llvm::opt::ArgList &Args) const {
727 }
728 
729 bool ToolChain::isThreadModelSupported(const StringRef Model) const {
730  if (Model == "single") {
731  // FIXME: 'single' is only supported on ARM and WebAssembly so far.
732  return Triple.getArch() == llvm::Triple::arm ||
733  Triple.getArch() == llvm::Triple::armeb ||
734  Triple.getArch() == llvm::Triple::thumb ||
735  Triple.getArch() == llvm::Triple::thumbeb || Triple.isWasm();
736  } else if (Model == "posix")
737  return true;
738 
739  return false;
740 }
741 
743  types::ID InputType) const {
744  switch (getTriple().getArch()) {
745  default:
746  return getTripleString();
747 
748  case llvm::Triple::x86_64: {
749  llvm::Triple Triple = getTriple();
750  if (!Triple.isOSBinFormatMachO())
751  return getTripleString();
752 
753  if (Arg *A = Args.getLastArg(options::OPT_march_EQ)) {
754  // x86_64h goes in the triple. Other -march options just use the
755  // vanilla triple we already have.
756  StringRef MArch = A->getValue();
757  if (MArch == "x86_64h")
758  Triple.setArchName(MArch);
759  }
760  return Triple.getTriple();
761  }
762  case llvm::Triple::aarch64: {
763  llvm::Triple Triple = getTriple();
764  if (!Triple.isOSBinFormatMachO())
765  return getTripleString();
766 
767  if (Triple.isArm64e())
768  return getTripleString();
769 
770  // FIXME: older versions of ld64 expect the "arm64" component in the actual
771  // triple string and query it to determine whether an LTO file can be
772  // handled. Remove this when we don't care any more.
773  Triple.setArchName("arm64");
774  return Triple.getTriple();
775  }
776  case llvm::Triple::aarch64_32:
777  return getTripleString();
778  case llvm::Triple::arm:
779  case llvm::Triple::armeb:
780  case llvm::Triple::thumb:
781  case llvm::Triple::thumbeb: {
782  llvm::Triple Triple = getTriple();
783  tools::arm::setArchNameInTriple(getDriver(), Args, InputType, Triple);
785  return Triple.getTriple();
786  }
787  }
788 }
789 
791  types::ID InputType) const {
792  return ComputeLLVMTriple(Args, InputType);
793 }
794 
796  return D.SysRoot;
797 }
798 
799 void ToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
800  ArgStringList &CC1Args) const {
801  // Each toolchain should provide the appropriate include flags.
802 }
803 
805  const ArgList &DriverArgs, ArgStringList &CC1Args,
806  Action::OffloadKind DeviceOffloadKind) const {}
807 
808 void ToolChain::addClangWarningOptions(ArgStringList &CC1Args) const {}
809 
810 void ToolChain::addProfileRTLibs(const llvm::opt::ArgList &Args,
811  llvm::opt::ArgStringList &CmdArgs) const {
812  if (!needsProfileRT(Args) && !needsGCovInstrumentation(Args))
813  return;
814 
815  CmdArgs.push_back(getCompilerRTArgString(Args, "profile"));
816 }
817 
819  const ArgList &Args) const {
820  if (runtimeLibType)
821  return *runtimeLibType;
822 
823  const Arg* A = Args.getLastArg(options::OPT_rtlib_EQ);
824  StringRef LibName = A ? A->getValue() : CLANG_DEFAULT_RTLIB;
825 
826  // Only use "platform" in tests to override CLANG_DEFAULT_RTLIB!
827  if (LibName == "compiler-rt")
828  runtimeLibType = ToolChain::RLT_CompilerRT;
829  else if (LibName == "libgcc")
830  runtimeLibType = ToolChain::RLT_Libgcc;
831  else if (LibName == "platform")
832  runtimeLibType = GetDefaultRuntimeLibType();
833  else {
834  if (A)
835  getDriver().Diag(diag::err_drv_invalid_rtlib_name)
836  << A->getAsString(Args);
837 
838  runtimeLibType = GetDefaultRuntimeLibType();
839  }
840 
841  return *runtimeLibType;
842 }
843 
845  const ArgList &Args) const {
846  if (unwindLibType)
847  return *unwindLibType;
848 
849  const Arg *A = Args.getLastArg(options::OPT_unwindlib_EQ);
850  StringRef LibName = A ? A->getValue() : CLANG_DEFAULT_UNWINDLIB;
851 
852  if (LibName == "none")
853  unwindLibType = ToolChain::UNW_None;
854  else if (LibName == "platform" || LibName == "") {
856  if (RtLibType == ToolChain::RLT_CompilerRT) {
857  if (getTriple().isAndroid() || getTriple().isOSAIX())
858  unwindLibType = ToolChain::UNW_CompilerRT;
859  else
860  unwindLibType = ToolChain::UNW_None;
861  } else if (RtLibType == ToolChain::RLT_Libgcc)
862  unwindLibType = ToolChain::UNW_Libgcc;
863  } else if (LibName == "libunwind") {
864  if (GetRuntimeLibType(Args) == RLT_Libgcc)
865  getDriver().Diag(diag::err_drv_incompatible_unwindlib);
866  unwindLibType = ToolChain::UNW_CompilerRT;
867  } else if (LibName == "libgcc")
868  unwindLibType = ToolChain::UNW_Libgcc;
869  else {
870  if (A)
871  getDriver().Diag(diag::err_drv_invalid_unwindlib_name)
872  << A->getAsString(Args);
873 
874  unwindLibType = GetDefaultUnwindLibType();
875  }
876 
877  return *unwindLibType;
878 }
879 
881  if (cxxStdlibType)
882  return *cxxStdlibType;
883 
884  const Arg *A = Args.getLastArg(options::OPT_stdlib_EQ);
885  StringRef LibName = A ? A->getValue() : CLANG_DEFAULT_CXX_STDLIB;
886 
887  // Only use "platform" in tests to override CLANG_DEFAULT_CXX_STDLIB!
888  if (LibName == "libc++")
889  cxxStdlibType = ToolChain::CST_Libcxx;
890  else if (LibName == "libstdc++")
891  cxxStdlibType = ToolChain::CST_Libstdcxx;
892  else if (LibName == "platform")
893  cxxStdlibType = GetDefaultCXXStdlibType();
894  else {
895  if (A)
896  getDriver().Diag(diag::err_drv_invalid_stdlib_name)
897  << A->getAsString(Args);
898 
899  cxxStdlibType = GetDefaultCXXStdlibType();
900  }
901 
902  return *cxxStdlibType;
903 }
904 
905 /// Utility function to add a system include directory to CC1 arguments.
906 /*static*/ void ToolChain::addSystemInclude(const ArgList &DriverArgs,
907  ArgStringList &CC1Args,
908  const Twine &Path) {
909  CC1Args.push_back("-internal-isystem");
910  CC1Args.push_back(DriverArgs.MakeArgString(Path));
911 }
912 
913 /// Utility function to add a system include directory with extern "C"
914 /// semantics to CC1 arguments.
915 ///
916 /// Note that this should be used rarely, and only for directories that
917 /// historically and for legacy reasons are treated as having implicit extern
918 /// "C" semantics. These semantics are *ignored* by and large today, but its
919 /// important to preserve the preprocessor changes resulting from the
920 /// classification.
921 /*static*/ void ToolChain::addExternCSystemInclude(const ArgList &DriverArgs,
922  ArgStringList &CC1Args,
923  const Twine &Path) {
924  CC1Args.push_back("-internal-externc-isystem");
925  CC1Args.push_back(DriverArgs.MakeArgString(Path));
926 }
927 
928 void ToolChain::addExternCSystemIncludeIfExists(const ArgList &DriverArgs,
929  ArgStringList &CC1Args,
930  const Twine &Path) {
931  if (llvm::sys::fs::exists(Path))
932  addExternCSystemInclude(DriverArgs, CC1Args, Path);
933 }
934 
935 /// Utility function to add a list of system include directories to CC1.
936 /*static*/ void ToolChain::addSystemIncludes(const ArgList &DriverArgs,
937  ArgStringList &CC1Args,
938  ArrayRef<StringRef> Paths) {
939  for (const auto &Path : Paths) {
940  CC1Args.push_back("-internal-isystem");
941  CC1Args.push_back(DriverArgs.MakeArgString(Path));
942  }
943 }
944 
945 /*static*/ std::string ToolChain::concat(StringRef Path, const Twine &A,
946  const Twine &B, const Twine &C,
947  const Twine &D) {
948  SmallString<128> Result(Path);
949  llvm::sys::path::append(Result, llvm::sys::path::Style::posix, A, B, C, D);
950  return std::string(Result);
951 }
952 
953 std::string ToolChain::detectLibcxxVersion(StringRef IncludePath) const {
954  std::error_code EC;
955  int MaxVersion = 0;
956  std::string MaxVersionString;
957  SmallString<128> Path(IncludePath);
958  llvm::sys::path::append(Path, "c++");
959  for (llvm::vfs::directory_iterator LI = getVFS().dir_begin(Path, EC), LE;
960  !EC && LI != LE; LI = LI.increment(EC)) {
961  StringRef VersionText = llvm::sys::path::filename(LI->path());
962  int Version;
963  if (VersionText[0] == 'v' &&
964  !VersionText.slice(1, StringRef::npos).getAsInteger(10, Version)) {
965  if (Version > MaxVersion) {
966  MaxVersion = Version;
967  MaxVersionString = std::string(VersionText);
968  }
969  }
970  }
971  if (!MaxVersion)
972  return "";
973  return MaxVersionString;
974 }
975 
976 void ToolChain::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
977  ArgStringList &CC1Args) const {
978  // Header search paths should be handled by each of the subclasses.
979  // Historically, they have not been, and instead have been handled inside of
980  // the CC1-layer frontend. As the logic is hoisted out, this generic function
981  // will slowly stop being called.
982  //
983  // While it is being called, replicate a bit of a hack to propagate the
984  // '-stdlib=' flag down to CC1 so that it can in turn customize the C++
985  // header search paths with it. Once all systems are overriding this
986  // function, the CC1 flag and this line can be removed.
987  DriverArgs.AddAllArgs(CC1Args, options::OPT_stdlib_EQ);
988 }
989 
991  const llvm::opt::ArgList &DriverArgs,
992  llvm::opt::ArgStringList &CC1Args) const {
993  DriverArgs.ClaimAllArgs(options::OPT_stdlibxx_isystem);
994  if (!DriverArgs.hasArg(options::OPT_nostdinc, options::OPT_nostdincxx,
995  options::OPT_nostdlibinc))
996  for (const auto &P :
997  DriverArgs.getAllArgValues(options::OPT_stdlibxx_isystem))
998  addSystemInclude(DriverArgs, CC1Args, P);
999 }
1000 
1001 bool ToolChain::ShouldLinkCXXStdlib(const llvm::opt::ArgList &Args) const {
1002  return getDriver().CCCIsCXX() &&
1003  !Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs,
1004  options::OPT_nostdlibxx);
1005 }
1006 
1007 void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args,
1008  ArgStringList &CmdArgs) const {
1009  assert(!Args.hasArg(options::OPT_nostdlibxx) &&
1010  "should not have called this");
1012 
1013  switch (Type) {
1014  case ToolChain::CST_Libcxx:
1015  CmdArgs.push_back("-lc++");
1016  break;
1017 
1019  CmdArgs.push_back("-lstdc++");
1020  break;
1021  }
1022 }
1023 
1024 void ToolChain::AddFilePathLibArgs(const ArgList &Args,
1025  ArgStringList &CmdArgs) const {
1026  for (const auto &LibPath : getFilePaths())
1027  if(LibPath.length() > 0)
1028  CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
1029 }
1030 
1031 void ToolChain::AddCCKextLibArgs(const ArgList &Args,
1032  ArgStringList &CmdArgs) const {
1033  CmdArgs.push_back("-lcc_kext");
1034 }
1035 
1036 bool ToolChain::isFastMathRuntimeAvailable(const ArgList &Args,
1037  std::string &Path) const {
1038  // Do not check for -fno-fast-math or -fno-unsafe-math when -Ofast passed
1039  // (to keep the linker options consistent with gcc and clang itself).
1040  if (!isOptimizationLevelFast(Args)) {
1041  // Check if -ffast-math or -funsafe-math.
1042  Arg *A =
1043  Args.getLastArg(options::OPT_ffast_math, options::OPT_fno_fast_math,
1044  options::OPT_funsafe_math_optimizations,
1045  options::OPT_fno_unsafe_math_optimizations);
1046 
1047  if (!A || A->getOption().getID() == options::OPT_fno_fast_math ||
1048  A->getOption().getID() == options::OPT_fno_unsafe_math_optimizations)
1049  return false;
1050  }
1051  // If crtfastmath.o exists add it to the arguments.
1052  Path = GetFilePath("crtfastmath.o");
1053  return (Path != "crtfastmath.o"); // Not found.
1054 }
1055 
1057  ArgStringList &CmdArgs) const {
1058  std::string Path;
1059  if (isFastMathRuntimeAvailable(Args, Path)) {
1060  CmdArgs.push_back(Args.MakeArgString(Path));
1061  return true;
1062  }
1063 
1064  return false;
1065 }
1066 
1068  // Return sanitizers which don't require runtime support and are not
1069  // platform dependent.
1070 
1071  SanitizerMask Res =
1072  (SanitizerKind::Undefined & ~SanitizerKind::Vptr &
1073  ~SanitizerKind::Function) |
1074  (SanitizerKind::CFI & ~SanitizerKind::CFIICall) |
1075  SanitizerKind::CFICastStrict | SanitizerKind::FloatDivideByZero |
1076  SanitizerKind::UnsignedIntegerOverflow |
1077  SanitizerKind::UnsignedShiftBase | SanitizerKind::ImplicitConversion |
1078  SanitizerKind::Nullability | SanitizerKind::LocalBounds;
1079  if (getTriple().getArch() == llvm::Triple::x86 ||
1080  getTriple().getArch() == llvm::Triple::x86_64 ||
1081  getTriple().getArch() == llvm::Triple::arm || getTriple().isWasm() ||
1082  getTriple().isAArch64() || getTriple().isRISCV())
1083  Res |= SanitizerKind::CFIICall;
1084  if (getTriple().getArch() == llvm::Triple::x86_64 ||
1085  getTriple().isAArch64(64) || getTriple().isRISCV())
1086  Res |= SanitizerKind::ShadowCallStack;
1087  if (getTriple().isAArch64(64))
1088  Res |= SanitizerKind::MemTag;
1089  return Res;
1090 }
1091 
1092 void ToolChain::AddCudaIncludeArgs(const ArgList &DriverArgs,
1093  ArgStringList &CC1Args) const {}
1094 
1095 void ToolChain::AddHIPIncludeArgs(const ArgList &DriverArgs,
1096  ArgStringList &CC1Args) const {}
1097 
1099 ToolChain::getHIPDeviceLibs(const ArgList &DriverArgs) const {
1100  return {};
1101 }
1102 
1103 void ToolChain::AddIAMCUIncludeArgs(const ArgList &DriverArgs,
1104  ArgStringList &CC1Args) const {}
1105 
1106 static VersionTuple separateMSVCFullVersion(unsigned Version) {
1107  if (Version < 100)
1108  return VersionTuple(Version);
1109 
1110  if (Version < 10000)
1111  return VersionTuple(Version / 100, Version % 100);
1112 
1113  unsigned Build = 0, Factor = 1;
1114  for (; Version > 10000; Version = Version / 10, Factor = Factor * 10)
1115  Build = Build + (Version % 10) * Factor;
1116  return VersionTuple(Version / 100, Version % 100, Build);
1117 }
1118 
1119 VersionTuple
1121  const llvm::opt::ArgList &Args) const {
1122  const Arg *MSCVersion = Args.getLastArg(options::OPT_fmsc_version);
1123  const Arg *MSCompatibilityVersion =
1124  Args.getLastArg(options::OPT_fms_compatibility_version);
1125 
1126  if (MSCVersion && MSCompatibilityVersion) {
1127  if (D)
1128  D->Diag(diag::err_drv_argument_not_allowed_with)
1129  << MSCVersion->getAsString(Args)
1130  << MSCompatibilityVersion->getAsString(Args);
1131  return VersionTuple();
1132  }
1133 
1134  if (MSCompatibilityVersion) {
1135  VersionTuple MSVT;
1136  if (MSVT.tryParse(MSCompatibilityVersion->getValue())) {
1137  if (D)
1138  D->Diag(diag::err_drv_invalid_value)
1139  << MSCompatibilityVersion->getAsString(Args)
1140  << MSCompatibilityVersion->getValue();
1141  } else {
1142  return MSVT;
1143  }
1144  }
1145 
1146  if (MSCVersion) {
1147  unsigned Version = 0;
1148  if (StringRef(MSCVersion->getValue()).getAsInteger(10, Version)) {
1149  if (D)
1150  D->Diag(diag::err_drv_invalid_value)
1151  << MSCVersion->getAsString(Args) << MSCVersion->getValue();
1152  } else {
1153  return separateMSVCFullVersion(Version);
1154  }
1155  }
1156 
1157  return VersionTuple();
1158 }
1159 
1160 llvm::opt::DerivedArgList *ToolChain::TranslateOpenMPTargetArgs(
1161  const llvm::opt::DerivedArgList &Args, bool SameTripleAsHost,
1162  SmallVectorImpl<llvm::opt::Arg *> &AllocatedArgs) const {
1163  DerivedArgList *DAL = new DerivedArgList(Args.getBaseArgs());
1164  const OptTable &Opts = getDriver().getOpts();
1165  bool Modified = false;
1166 
1167  // Handle -Xopenmp-target flags
1168  for (auto *A : Args) {
1169  // Exclude flags which may only apply to the host toolchain.
1170  // Do not exclude flags when the host triple (AuxTriple)
1171  // matches the current toolchain triple. If it is not present
1172  // at all, target and host share a toolchain.
1173  if (A->getOption().matches(options::OPT_m_Group)) {
1174  if (SameTripleAsHost)
1175  DAL->append(A);
1176  else
1177  Modified = true;
1178  continue;
1179  }
1180 
1181  unsigned Index;
1182  unsigned Prev;
1183  bool XOpenMPTargetNoTriple =
1184  A->getOption().matches(options::OPT_Xopenmp_target);
1185 
1186  if (A->getOption().matches(options::OPT_Xopenmp_target_EQ)) {
1187  llvm::Triple TT(getOpenMPTriple(A->getValue(0)));
1188 
1189  // Passing device args: -Xopenmp-target=<triple> -opt=val.
1190  if (TT.getTriple() == getTripleString())
1191  Index = Args.getBaseArgs().MakeIndex(A->getValue(1));
1192  else
1193  continue;
1194  } else if (XOpenMPTargetNoTriple) {
1195  // Passing device args: -Xopenmp-target -opt=val.
1196  Index = Args.getBaseArgs().MakeIndex(A->getValue(0));
1197  } else {
1198  DAL->append(A);
1199  continue;
1200  }
1201 
1202  // Parse the argument to -Xopenmp-target.
1203  Prev = Index;
1204  std::unique_ptr<Arg> XOpenMPTargetArg(Opts.ParseOneArg(Args, Index));
1205  if (!XOpenMPTargetArg || Index > Prev + 1) {
1206  getDriver().Diag(diag::err_drv_invalid_Xopenmp_target_with_args)
1207  << A->getAsString(Args);
1208  continue;
1209  }
1210  if (XOpenMPTargetNoTriple && XOpenMPTargetArg &&
1211  Args.getAllArgValues(options::OPT_fopenmp_targets_EQ).size() != 1) {
1212  getDriver().Diag(diag::err_drv_Xopenmp_target_missing_triple);
1213  continue;
1214  }
1215  XOpenMPTargetArg->setBaseArg(A);
1216  A = XOpenMPTargetArg.release();
1217  AllocatedArgs.push_back(A);
1218  DAL->append(A);
1219  Modified = true;
1220  }
1221 
1222  if (Modified)
1223  return DAL;
1224 
1225  delete DAL;
1226  return nullptr;
1227 }
1228 
1229 // TODO: Currently argument values separated by space e.g.
1230 // -Xclang -mframe-pointer=no cannot be passed by -Xarch_. This should be
1231 // fixed.
1233  const llvm::opt::DerivedArgList &Args, llvm::opt::Arg *&A,
1234  llvm::opt::DerivedArgList *DAL,
1235  SmallVectorImpl<llvm::opt::Arg *> *AllocatedArgs) const {
1236  const OptTable &Opts = getDriver().getOpts();
1237  unsigned ValuePos = 1;
1238  if (A->getOption().matches(options::OPT_Xarch_device) ||
1239  A->getOption().matches(options::OPT_Xarch_host))
1240  ValuePos = 0;
1241 
1242  unsigned Index = Args.getBaseArgs().MakeIndex(A->getValue(ValuePos));
1243  unsigned Prev = Index;
1244  std::unique_ptr<llvm::opt::Arg> XarchArg(Opts.ParseOneArg(Args, Index));
1245 
1246  // If the argument parsing failed or more than one argument was
1247  // consumed, the -Xarch_ argument's parameter tried to consume
1248  // extra arguments. Emit an error and ignore.
1249  //
1250  // We also want to disallow any options which would alter the
1251  // driver behavior; that isn't going to work in our model. We
1252  // use options::NoXarchOption to control this.
1253  if (!XarchArg || Index > Prev + 1) {
1254  getDriver().Diag(diag::err_drv_invalid_Xarch_argument_with_args)
1255  << A->getAsString(Args);
1256  return;
1257  } else if (XarchArg->getOption().hasFlag(options::NoXarchOption)) {
1258  auto &Diags = getDriver().getDiags();
1259  unsigned DiagID =
1261  "invalid Xarch argument: '%0', not all driver "
1262  "options can be forwared via Xarch argument");
1263  Diags.Report(DiagID) << A->getAsString(Args);
1264  return;
1265  }
1266  XarchArg->setBaseArg(A);
1267  A = XarchArg.release();
1268  if (!AllocatedArgs)
1269  DAL->AddSynthesizedArg(A);
1270  else
1271  AllocatedArgs->push_back(A);
1272 }
1273 
1274 llvm::opt::DerivedArgList *ToolChain::TranslateXarchArgs(
1275  const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
1276  Action::OffloadKind OFK,
1277  SmallVectorImpl<llvm::opt::Arg *> *AllocatedArgs) const {
1278  DerivedArgList *DAL = new DerivedArgList(Args.getBaseArgs());
1279  bool Modified = false;
1280 
1281  bool IsGPU = OFK == Action::OFK_Cuda || OFK == Action::OFK_HIP;
1282  for (Arg *A : Args) {
1283  bool NeedTrans = false;
1284  bool Skip = false;
1285  if (A->getOption().matches(options::OPT_Xarch_device)) {
1286  NeedTrans = IsGPU;
1287  Skip = !IsGPU;
1288  } else if (A->getOption().matches(options::OPT_Xarch_host)) {
1289  NeedTrans = !IsGPU;
1290  Skip = IsGPU;
1291  } else if (A->getOption().matches(options::OPT_Xarch__) && IsGPU) {
1292  // Do not translate -Xarch_ options for non CUDA/HIP toolchain since
1293  // they may need special translation.
1294  // Skip this argument unless the architecture matches BoundArch
1295  if (BoundArch.empty() || A->getValue(0) != BoundArch)
1296  Skip = true;
1297  else
1298  NeedTrans = true;
1299  }
1300  if (NeedTrans || Skip)
1301  Modified = true;
1302  if (NeedTrans)
1303  TranslateXarchArgs(Args, A, DAL, AllocatedArgs);
1304  if (!Skip)
1305  DAL->append(A);
1306  }
1307 
1308  if (Modified)
1309  return DAL;
1310 
1311  delete DAL;
1312  return nullptr;
1313 }
clang::driver::tools::OffloadPackager
Offload binary tool.
Definition: Clang.h:174
clang::driver::ToolChain::buildStaticLibTool
virtual Tool * buildStaticLibTool() const
Definition: ToolChain.cpp:314
clang::driver::Driver::GetProgramPath
std::string GetProgramPath(StringRef Name, const ToolChain &TC) const
GetProgramPath - Lookup Name in the list of program search paths.
Definition: Driver.cpp:5801
llvm
YAML serialization mapping.
Definition: Dominators.h:30
clang::driver::isOptimizationLevelFast
bool isOptimizationLevelFast(const llvm::opt::ArgList &Args)
clang::driver::ToolChain::getCompilerRT
virtual std::string getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component, FileType Type=ToolChain::FT_Static) const
Definition: ToolChain.cpp:511
clang::driver::ToolChain::getVFS
llvm::vfs::FileSystem & getVFS() const
Definition: ToolChain.cpp:99
XRayArgs.h
ObjCRuntime.h
clang::driver::tools::arm::setFloatABIInTriple
void setFloatABIInTriple(const Driver &D, const llvm::opt::ArgList &Args, llvm::Triple &triple)
clang::driver::ParsedClangName
Helper structure used to pass information extracted from clang executable name such as i686-linux-and...
Definition: ToolChain.h:64
clang::ento::Nullability
Nullability
Definition: CheckerHelpers.h:55
clang::ObjCRuntime::GCC
@ GCC
'gcc' is the Objective-C runtime shipped with GCC, implementing a fragile Objective-C ABI
Definition: ObjCRuntime.h:53
Driver.h
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::driver::Driver::Dir
std::string Dir
The path the driver executable was in, as invoked from the command line.
Definition: Driver.h:150
clang::driver::ToolChain::getDefaultLinker
virtual const char * getDefaultLinker() const
GetDefaultLinker - Get the default linker to use.
Definition: ToolChain.h:448
clang::driver::ToolChain::getTargetAndModeFromProgramName
static ParsedClangName getTargetAndModeFromProgramName(StringRef ProgName)
Return any implicit target and/or mode flag for an invocation of the compiler driver as ProgName.
Definition: ToolChain.cpp:237
clang::driver::ToolChain::computeMSVCVersion
virtual VersionTuple computeMSVCVersion(const Driver *D, const llvm::opt::ArgList &Args) const
On Windows, returns the MSVC compatibility version.
Definition: ToolChain.cpp:1120
clang::driver::ToolChain::buildCompilerRTBasename
virtual std::string buildCompilerRTBasename(const llvm::opt::ArgList &Args, StringRef Component, FileType Type, bool AddArch) const
Definition: ToolChain.cpp:477
clang::driver::Action::OFK_Cuda
@ OFK_Cuda
Definition: Action.h:95
clang::driver::ToolChain::getDefaultObjCRuntime
virtual ObjCRuntime getDefaultObjCRuntime(bool isNonFragile) const
getDefaultObjCRuntime - Return the default Objective-C runtime for this platform.
Definition: ToolChain.cpp:719
clang::driver::ToolChain::TranslateXarchArgs
virtual void TranslateXarchArgs(const llvm::opt::DerivedArgList &Args, llvm::opt::Arg *&A, llvm::opt::DerivedArgList *DAL, SmallVectorImpl< llvm::opt::Arg * > *AllocatedArgs=nullptr) const
Append the argument following A to DAL assuming A is an Xarch argument.
Definition: ToolChain.cpp:1232
llvm::SmallVector< std::string, 16 >
clang::driver::tools::arm::getARMFloatABI
FloatABI getARMFloatABI(const ToolChain &TC, const llvm::opt::ArgList &Args)
clang::driver::Action::ActionClass
ActionClass
Definition: Action.h:55
clang::driver::ToolChain::needsProfileRT
static bool needsProfileRT(const llvm::opt::ArgList &Args)
needsProfileRT - returns true if instrumentation profile is on.
Definition: ToolChain.cpp:576
clang::driver::Action::getKind
ActionClass getKind() const
Definition: Action.h:148
clang::driver::ToolChain::GetProgramPath
std::string GetProgramPath(const char *Name) const
Definition: ToolChain.cpp:609
clang::driver::Action::ExtractAPIJobClass
@ ExtractAPIJobClass
Definition: Action.h:62
clang::driver::Action::LipoJobClass
@ LipoJobClass
Definition: Action.h:70
clang::driver::ToolChain::AddClangCXXStdlibIncludeArgs
virtual void AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
AddClangCXXStdlibIncludeArgs - Add the clang -cc1 level arguments to set the include paths to use for...
Definition: ToolChain.cpp:976
clang::driver::ToolChain::getDefaultUniversalArchName
StringRef getDefaultUniversalArchName() const
Provide the default architecture name (as expected by -arch) for this toolchain.
Definition: ToolChain.cpp:261
clang::driver::ToolChain::getDriver
const Driver & getDriver() const
Definition: ToolChain.h:228
Job.h
clang::driver::ToolChain::detectLibcxxVersion
virtual std::string detectLibcxxVersion(StringRef IncludePath) const
Definition: ToolChain.cpp:953
parseDriverSuffix
static const DriverSuffix * parseDriverSuffix(StringRef ProgName, size_t &Pos)
Definition: ToolChain.cpp:210
clang::driver::Action::OffloadBundlingJobClass
@ OffloadBundlingJobClass
Definition: Action.h:74
clang::driver::ToolChain::FT_Object
@ FT_Object
Definition: ToolChain.h:123
clang::driver::tools::ClangAs
Clang integrated assembler tool.
Definition: Clang.h:122
clang::driver::ToolChain::getTripleString
std::string getTripleString() const
Definition: ToolChain.h:253
clang::driver::Action::OFK_HIP
@ OFK_HIP
Definition: Action.h:97
clang::driver::ToolChain::addFastMathRuntimeIfAvailable
bool addFastMathRuntimeIfAvailable(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
AddFastMathRuntimeIfAvailable - If a runtime library exists that sets global flags for unsafe floatin...
Definition: ToolChain.cpp:1056
clang::driver::ToolChain::getCompilerRTPath
virtual std::string getCompilerRTPath() const
Definition: ToolChain.cpp:460
clang::driver::Action::AssembleJobClass
@ AssembleJobClass
Definition: Action.h:67
clang::driver::tools::LinkerWrapper
Linker wrapper tool.
Definition: Clang.h:187
clang::driver::ToolChain::HasNativeLLVMSupport
virtual bool HasNativeLLVMSupport() const
HasNativeLTOLinker - Check whether the linker and related tools have native LLVM support.
Definition: ToolChain.cpp:699
clang::driver::ToolChain::GetFilePath
std::string GetFilePath(const char *Name) const
Definition: ToolChain.cpp:605
clang::driver::ToolChain::addClangWarningOptions
virtual void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const
Add warning options that need to be passed to cc1 for this target.
Definition: ToolChain.cpp:808
clang::driver::Driver::getOpts
const llvm::opt::OptTable & getOpts() const
Definition: Driver.h:360
clang::driver::ToolChain::getSanitizerArgs
SanitizerArgs getSanitizerArgs(const llvm::opt::ArgList &JobArgs) const
Definition: ToolChain.cpp:146
clang::driver::ToolChain::getInputFilename
virtual std::string getInputFilename(const InputInfo &Input) const
Some toolchains need to modify the file name, for example to replace the extension for object files w...
Definition: ToolChain.cpp:286
clang::driver::InputInfo
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
clang::driver::ToolChain::addExternCSystemIncludeIfExists
static void addExternCSystemIncludeIfExists(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, const Twine &Path)
Definition: ToolChain.cpp:928
clang::driver::Driver::getDiags
DiagnosticsEngine & getDiags() const
Definition: Driver.h:362
clang::driver::ToolChain::RuntimeLibType
RuntimeLibType
Definition: ToolChain.h:100
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1556
clang::driver::ToolChain::useIntegratedBackend
virtual bool useIntegratedBackend() const
Check if the toolchain should use the integrated backend.
Definition: ToolChain.cpp:109
InputInfo.h
clang::driver::XRayArgs
Definition: XRayArgs.h:21
clang::driver::types::lookupTypeForExtension
ID lookupTypeForExtension(llvm::StringRef Ext)
lookupTypeForExtension - Lookup the type to use for the file extension Ext.
Definition: Types.cpp:293
clang::driver::tools::arm::setArchNameInTriple
void setArchNameInTriple(const Driver &D, const llvm::opt::ArgList &Args, types::ID InputType, llvm::Triple &Triple)
Action.h
clang::driver::Action::PreprocessJobClass
@ PreprocessJobClass
Definition: Action.h:59
clang::driver::Action::DsymutilJobClass
@ DsymutilJobClass
Definition: Action.h:71
clang::driver::ToolChain::getFilePaths
path_list & getFilePaths()
Definition: ToolChain.h:266
clang::driver::Driver::Diag
DiagnosticBuilder Diag(unsigned DiagID) const
Definition: Driver.h:139
clang::driver::Tool
Tool - Information on a specific compilation tool.
Definition: Tool.h:32
clang::driver::ToolChain::ToolChain
ToolChain(const Driver &D, const llvm::Triple &T, const llvm::opt::ArgList &Args)
Definition: ToolChain.cpp:75
Options.h
clang::driver::ToolChain::getHIPDeviceLibs
virtual llvm::SmallVector< BitCodeLibraryInfo, 12 > getHIPDeviceLibs(const llvm::opt::ArgList &Args) const
Get paths of HIP device libraries.
Definition: ToolChain.cpp:1099
clang::driver::ToolChain::concat
static std::string concat(StringRef Path, const Twine &A, const Twine &B="", const Twine &C="", const Twine &D="")
Definition: ToolChain.cpp:945
clang::XRayInstrKind::None
constexpr XRayInstrMask None
Definition: XRayInstr.h:38
clang::interp::LE
bool LE(InterpState &S, CodePtr OpPC)
Definition: Interp.h:239
getArchNameForCompilerRTLib
static StringRef getArchNameForCompilerRTLib(const ToolChain &TC, const ArgList &Args)
Definition: ToolChain.cpp:420
clang::driver::ToolChain::isFastMathRuntimeAvailable
virtual bool isFastMathRuntimeAvailable(const llvm::opt::ArgList &Args, std::string &Path) const
If a runtime library exists that sets global flags for unsafe floating point math,...
Definition: ToolChain.cpp:1036
clang::driver::ToolChain::getOS
StringRef getOS() const
Definition: ToolChain.h:247
clang::driver::ToolChain::UNW_None
@ UNW_None
Definition: ToolChain.h:106
clang::driver::ToolChain::IsUnwindTablesDefault
virtual bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const
IsUnwindTablesDefault - Does this tool chain use -funwind-tables by default.
Definition: ToolChain.cpp:290
llvm::opt
Definition: DiagnosticOptions.h:19
DriverDiagnostic.h
clang::driver::Action::OffloadUnbundlingJobClass
@ OffloadUnbundlingJobClass
Definition: Action.h:75
FindDriverSuffix
static const DriverSuffix * FindDriverSuffix(StringRef ProgName, size_t &Pos)
Definition: ToolChain.cpp:167
clang::DiagnosticsEngine::Error
@ Error
Definition: Diagnostic.h:200
clang::driver::ToolChain::AddClangSystemIncludeArgs
virtual void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
Add the clang cc1 arguments for system include paths.
Definition: ToolChain.cpp:799
clang::driver::ToolChain::RLT_Libgcc
@ RLT_Libgcc
Definition: ToolChain.h:102
clang::driver::ToolChain::AddCCKextLibArgs
virtual void AddCCKextLibArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
AddCCKextLibArgs - Add the system specific linker arguments to use for kernel extensions (Darwin-spec...
Definition: ToolChain.cpp:1031
clang::driver::tools::OffloadWrapper
Offload wrapper tool.
Definition: Clang.h:161
clang::driver::ToolChain::CXXStdlibType
CXXStdlibType
Definition: ToolChain.h:95
clang::driver::Action::OffloadPackagerJobClass
@ OffloadPackagerJobClass
Definition: Action.h:77
Clang.h
llvm::SmallString< 128 >
clang::driver::ToolChain::getTriple
const llvm::Triple & getTriple() const
Definition: ToolChain.h:230
clang::driver::ToolChain::SelectTool
virtual Tool * SelectTool(const JobAction &JA) const
Choose a tool to use to handle the action JA.
Definition: ToolChain.cpp:596
InterfaceStubs.h
clang::driver::ToolChain::buildLinker
virtual Tool * buildLinker() const
Definition: ToolChain.cpp:310
clang::driver::Driver::SysRoot
std::string SysRoot
sysroot, if present
Definition: Driver.h:178
normalizeProgramName
static std::string normalizeProgramName(llvm::StringRef Argv0)
Normalize the program name from argv[0] by stripping the file extension if present and lower-casing t...
Definition: ToolChain.cpp:200
clang::driver::ToolChain::IsIntegratedAssemblerDefault
virtual bool IsIntegratedAssemblerDefault() const
IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as by default.
Definition: ToolChain.h:389
clang::driver::tools::Clang
Clang compiler tool.
Definition: Clang.h:28
clang::driver::ToolChain::setTripleEnvironment
void setTripleEnvironment(llvm::Triple::EnvironmentType Env)
Definition: ToolChain.cpp:91
clang::driver::ToolChain::getStdlibPaths
path_list getStdlibPaths() const
Definition: ToolChain.cpp:560
separateMSVCFullVersion
static VersionTuple separateMSVCFullVersion(unsigned Version)
Definition: ToolChain.cpp:1106
clang::driver::Action::OffloadClass
@ OffloadClass
Definition: Action.h:58
clang::driver::ToolChain::CST_Libcxx
@ CST_Libcxx
Definition: ToolChain.h:96
clang::driver::Driver::CCCIsCXX
bool CCCIsCXX() const
Whether the driver should follow g++ like behavior.
Definition: Driver.h:208
clang::driver::ToolChain::UNW_CompilerRT
@ UNW_CompilerRT
Definition: ToolChain.h:107
clang::driver::ToolChain::TranslateOpenMPTargetArgs
virtual llvm::opt::DerivedArgList * TranslateOpenMPTargetArgs(const llvm::opt::DerivedArgList &Args, bool SameTripleAsHost, SmallVectorImpl< llvm::opt::Arg * > &AllocatedArgs) const
TranslateOpenMPTargetArgs - Create a new derived argument list for that contains the OpenMP target sp...
Definition: ToolChain.cpp:1160
clang::driver::tools::Flang
Flang compiler tool.
Definition: Flang.h:25
clang::driver::SanitizerArgs
Definition: SanitizerArgs.h:24
SanitizerArgs.h
clang::driver::ToolChain::UNW_Libgcc
@ UNW_Libgcc
Definition: ToolChain.h:108
clang::driver::ToolChain::CST_Libstdcxx
@ CST_Libstdcxx
Definition: ToolChain.h:97
clang::driver::ToolChain::GetExceptionModel
virtual llvm::ExceptionHandling GetExceptionModel(const llvm::opt::ArgList &Args) const
GetExceptionModel - Return the tool chain exception model.
Definition: ToolChain.cpp:725
clang::driver::Driver::ResourceDir
std::string ResourceDir
The path to the compiler resource directory.
Definition: Driver.h:162
clang::driver::ToolChain::getArch
llvm::Triple::ArchType getArch() const
Definition: ToolChain.h:244
clang::driver::ToolChain::AddFilePathLibArgs
void AddFilePathLibArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
AddFilePathLibArgs - Add each thing in getFilePaths() as a "-L" option.
Definition: ToolChain.cpp:1024
clang::driver::ToolChain::ShouldLinkCXXStdlib
bool ShouldLinkCXXStdlib(const llvm::opt::ArgList &Args) const
Returns if the C++ standard library should be linked in.
Definition: ToolChain.cpp:1001
clang::driver::ToolChain::getRuntimePaths
path_list getRuntimePaths() const
Definition: ToolChain.cpp:538
clang::driver::Action::PrecompileJobClass
@ PrecompileJobClass
Definition: Action.h:60
clang::driver::Action::StaticLibJobClass
@ StaticLibJobClass
Definition: Action.h:79
clang::driver::Action::LinkerWrapperJobClass
@ LinkerWrapperJobClass
Definition: Action.h:78
clang::driver::ToolChain::getCompilerRTBasename
std::string getCompilerRTBasename(const llvm::opt::ArgList &Args, StringRef Component, FileType Type=ToolChain::FT_Static) const
Definition: ToolChain.cpp:470
clang::driver::options::NoXarchOption
@ NoXarchOption
Definition: Options.h:25
ToolChain.h
clang::driver::ToolChain::FT_Static
@ FT_Static
Definition: ToolChain.h:123
GetRTTIArgument
static llvm::opt::Arg * GetRTTIArgument(const ArgList &Args)
Definition: ToolChain.cpp:54
clang::driver::ToolChain::GetUnwindLibType
virtual UnwindLibType GetUnwindLibType(const llvm::opt::ArgList &Args) const
Definition: ToolChain.cpp:844
P
StringRef P
Definition: ASTMatchersInternal.cpp:563
clang::driver::ToolChain::getSupportedSanitizers
virtual SanitizerMask getSupportedSanitizers() const
Return sanitizers which are available in this toolchain.
Definition: ToolChain.cpp:1067
clang::driver::ToolChain::getTool
virtual Tool * getTool(Action::ActionClass AC) const
Definition: ToolChain.cpp:372
clang::driver::Action::BackendJobClass
@ BackendJobClass
Definition: Action.h:66
clang::driver::ToolChain::addSystemIncludes
static void addSystemIncludes(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, ArrayRef< StringRef > Paths)
Utility function to add a list of system include directories to CC1.
Definition: ToolChain.cpp:936
clang::driver::ToolChain::AddCXXStdlibLibArgs
virtual void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
AddCXXStdlibLibArgs - Add the system specific linker arguments to use for the given C++ standard libr...
Definition: ToolChain.cpp:1007
clang::driver::ToolChain::getArchSpecificLibPath
std::string getArchSpecificLibPath() const
Definition: ToolChain.cpp:569
clang::driver::ToolChain::RM_Enabled
@ RM_Enabled
Definition: ToolChain.h:112
clang::ObjCRuntime::GNUstep
@ GNUstep
'gnustep' is the modern non-fragile GNUstep runtime.
Definition: ObjCRuntime.h:56
clang::driver::ToolChain::GetRuntimeLibType
virtual RuntimeLibType GetRuntimeLibType(const llvm::opt::ArgList &Args) const
Definition: ToolChain.cpp:818
clang::driver::ToolChain::addProfileRTLibs
virtual void addProfileRTLibs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
addProfileRTLibs - When -fprofile-instr-profile is specified, try to pass a suitable profile runtime ...
Definition: ToolChain.cpp:810
clang::driver::Action::AnalyzeJobClass
@ AnalyzeJobClass
Definition: Action.h:63
clang::driver::ToolChain::getCompilerRTArgString
const char * getCompilerRTArgString(const llvm::opt::ArgList &Args, StringRef Component, FileType Type=ToolChain::FT_Static) const
Definition: ToolChain.cpp:532
clang::driver::ToolChain::getOpenMPTriple
static llvm::Triple getOpenMPTriple(StringRef TripleStr)
Definition: ToolChain.h:748
clang::driver::ToolChain
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:91
clang::driver::ToolChain::GetLinkerPath
std::string GetLinkerPath(bool *LinkerIsLLD=nullptr) const
Returns the linker path, respecting the -fuse-ld= argument to determine the linker suffix or name.
Definition: ToolChain.cpp:613
clang::driver::ToolChain::RLT_CompilerRT
@ RLT_CompilerRT
Definition: ToolChain.h:101
llvm::ArrayRef
Definition: LLVM.h:34
clang::driver::ToolChain::AddCudaIncludeArgs
virtual void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
Add arguments to use system-specific CUDA includes.
Definition: ToolChain.cpp:1092
clang::driver::ToolChain::LookupTypeForExtension
virtual types::ID LookupTypeForExtension(StringRef Ext) const
LookupTypeForExtension - Return the default language type to use for the given extension.
Definition: ToolChain.cpp:687
clang::SanitizerKind
Definition: Sanitizers.h:131
clang::driver::ToolChain::useIntegratedAs
virtual bool useIntegratedAs() const
Check if the toolchain should use the integrated assembler.
Definition: ToolChain.cpp:103
clang::driver::ToolChain::AddClangCXXStdlibIsystemArgs
void AddClangCXXStdlibIsystemArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
AddClangCXXStdlibIsystemArgs - Add the clang -cc1 level arguments to set the specified include paths ...
Definition: ToolChain.cpp:990
clang::driver::ToolChain::computeSysRoot
virtual std::string computeSysRoot() const
Return the sysroot, possibly searching for a default sysroot using target-specific logic.
Definition: ToolChain.cpp:795
clang::driver::ToolChain::ComputeLLVMTriple
virtual std::string ComputeLLVMTriple(const llvm::opt::ArgList &Args, types::ID InputType=types::TY_INVALID) const
ComputeLLVMTriple - Return the LLVM target triple to use, after taking command line arguments into ac...
Definition: ToolChain.cpp:742
clang::driver::ToolChain::getLibraryPaths
path_list & getLibraryPaths()
Definition: ToolChain.h:263
clang::driver::Action::BindArchClass
@ BindArchClass
Definition: Action.h:57
clang::driver::ToolChain::IsNonIntegratedBackendSupported
virtual bool IsNonIntegratedBackendSupported() const
IsNonIntegratedBackendSupported - Does this tool chain support -fno-integrated-objemitter.
Definition: ToolChain.h:401
clang::driver::types::ID
ID
Definition: Types.h:23
clang::driver::tools::OffloadBundler
Offload bundler tool.
Definition: Clang.h:143
clang::ObjCRuntime
The basic abstraction for the target Objective-C runtime.
Definition: ObjCRuntime.h:28
clang::driver::Action::CompileJobClass
@ CompileJobClass
Definition: Action.h:65
clang::driver::ToolChain::getOSLibName
virtual StringRef getOSLibName() const
Definition: ToolChain.cpp:440
clang::driver::ToolChain::IsIntegratedBackendSupported
virtual bool IsIntegratedBackendSupported() const
IsIntegratedBackendSupported - Does this tool chain support -fintegrated-objemitter.
Definition: ToolChain.h:397
clang::driver::ToolChain::FileType
FileType
Definition: ToolChain.h:123
clang::driver::Driver::GetFilePath
std::string GetFilePath(StringRef Name, const ToolChain &TC) const
GetFilePath - Lookup Name in the list of file search paths.
Definition: Driver.cpp:5741
clang::driver::ToolChain::GetDefaultCXXStdlibType
virtual CXXStdlibType GetDefaultCXXStdlibType() const
Definition: ToolChain.h:455
clang::driver::ToolChain::GetCXXStdlibType
virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const
Definition: ToolChain.cpp:880
clang::driver::ToolChain::AddIAMCUIncludeArgs
virtual void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
Add arguments to use MCU GCC toolchain includes.
Definition: ToolChain.cpp:1103
clang::driver::ToolChain::GetDefaultUnwindLibType
virtual UnwindLibType GetDefaultUnwindLibType() const
Definition: ToolChain.h:459
Sanitizers.h
clang::driver::InputInfo::getFilename
const char * getFilename() const
Definition: InputInfo.h:83
clang::driver::ToolChain::isThreadModelSupported
virtual bool isThreadModelSupported(const StringRef Model) const
isThreadModelSupported() - Does this target support a thread model?
Definition: ToolChain.cpp:729
clang::DiagnosticsEngine::getCustomDiagID
unsigned getCustomDiagID(Level L, const char(&FormatString)[N])
Return an ID for a diagnostic with the specified format string and level.
Definition: Diagnostic.h:868
clang
Definition: CalledOnceCheck.h:17
clang::driver::Driver
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:72
clang::driver::Action::MigrateJobClass
@ MigrateJobClass
Definition: Action.h:64
clang::driver::Action::OffloadWrapperJobClass
@ OffloadWrapperJobClass
Definition: Action.h:76
clang::driver::Action::HeaderModulePrecompileJobClass
@ HeaderModulePrecompileJobClass
Definition: Action.h:61
clang::driver::ToolChain::defaultToIEEELongDouble
bool defaultToIEEELongDouble() const
Check whether use IEEE binary128 as long double format by default.
Definition: ToolChain.cpp:141
clang::driver::tools::ifstool::Merger
Definition: InterfaceStubs.h:19
clang::driver::ToolChain::UnwindLibType
UnwindLibType
Definition: ToolChain.h:105
clang::driver::ToolChain::AddHIPIncludeArgs
virtual void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
Add arguments to use system-specific HIP includes.
Definition: ToolChain.cpp:1095
clang::driver::Action::VerifyDebugInfoJobClass
@ VerifyDebugInfoJobClass
Definition: Action.h:72
clang::driver::Driver::getVFS
llvm::vfs::FileSystem & getVFS() const
Definition: Driver.h:364
CalculateRTTIMode
static ToolChain::RTTIMode CalculateRTTIMode(const ArgList &Args, const llvm::Triple &Triple, const Arg *CachedRTTIArg)
Definition: ToolChain.cpp:59
clang::driver::ToolChain::addExternCSystemInclude
static void addExternCSystemInclude(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, const Twine &Path)
Utility function to add a system include directory with extern "C" semantics to CC1 arguments.
Definition: ToolChain.cpp:921
clang::driver::ToolChain::needsGCovInstrumentation
static bool needsGCovInstrumentation(const llvm::opt::ArgList &Args)
Returns true if gcov instrumentation (-fprofile-arcs or –coverage) is on.
Definition: ToolChain.cpp:590
clang::driver::ToolChain::addClangTargetOptions
virtual void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, Action::OffloadKind DeviceOffloadKind) const
Add options that need to be passed to cc1 for this target.
Definition: ToolChain.cpp:804
clang::driver::ToolChain::isCrossCompiling
virtual bool isCrossCompiling() const
Returns true if the toolchain is targeting a non-native architecture.
Definition: ToolChain.cpp:703
clang::driver::ToolChain::RTTIMode
RTTIMode
Definition: ToolChain.h:111
ARM.h
clang::driver::ToolChain::getXRayArgs
const XRayArgs & getXRayArgs() const
Definition: ToolChain.cpp:152
clang::driver::Action::OffloadKind
OffloadKind
Definition: Action.h:88
clang::driver::ToolChain::useRelaxRelocations
virtual bool useRelaxRelocations() const
Check whether to enable x86 relax relocations by default.
Definition: ToolChain.cpp:137
Flang.h
clang::driver::ToolChain::~ToolChain
virtual ~ToolChain()
llvm::SmallVectorImpl
Definition: Randstruct.h:18
clang::driver::ToolChain::addSystemInclude
static void addSystemInclude(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, const Twine &Path)
Utility function to add a system include directory to CC1 arguments.
Definition: ToolChain.cpp:906
AIX
clang::driver::toolchains::AIX AIX
Definition: AIX.cpp:18
clang::driver::ToolChain::FT_Shared
@ FT_Shared
Definition: ToolChain.h:123
clang::driver::JobAction
Definition: Action.h:395
clang::driver::Action::LinkJobClass
@ LinkJobClass
Definition: Action.h:68
clang::driver::Action::IfsMergeJobClass
@ IfsMergeJobClass
Definition: Action.h:69
clang::driver::ToolChain::GetDefaultRuntimeLibType
virtual RuntimeLibType GetDefaultRuntimeLibType() const
GetDefaultRuntimeLibType - Get the default runtime library variant to use.
Definition: ToolChain.h:451
clang::driver::ToolChain::buildAssembler
virtual Tool * buildAssembler() const
Definition: ToolChain.cpp:306
clang::SanitizerMask
Definition: Sanitizers.h:30
clang::driver::Action::InputClass
@ InputClass
Definition: Action.h:56
clang::driver::ToolChain::IsIntegratedBackendDefault
virtual bool IsIntegratedBackendDefault() const
IsIntegratedBackendDefault - Does this tool chain enable -fintegrated-objemitter by default.
Definition: ToolChain.h:393
clang::driver::Driver::IsFlangMode
bool IsFlangMode() const
Whether the driver should invoke flang for fortran inputs.
Definition: Driver.h:221
clang::driver::ToolChain::GetStaticLibToolPath
std::string GetStaticLibToolPath() const
Returns the linker path for emitting a static library.
Definition: ToolChain.cpp:680
clang::driver::Action::VerifyPCHJobClass
@ VerifyPCHJobClass
Definition: Action.h:73
clang::driver::ToolChain::ComputeEffectiveClangTriple
virtual std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args, types::ID InputType=types::TY_INVALID) const
ComputeEffectiveClangTriple - Return the Clang triple to use for this target, which may take into acc...
Definition: ToolChain.cpp:790
clang::driver::ToolChain::RM_Disabled
@ RM_Disabled
Definition: ToolChain.h:113