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