clang  7.0.0svn
MinGW.cpp
Go to the documentation of this file.
1 //===--- MinGW.cpp - MinGWToolChain Implementation ------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "MinGW.h"
11 #include "InputInfo.h"
12 #include "CommonArgs.h"
14 #include "clang/Driver/Driver.h"
16 #include "clang/Driver/Options.h"
17 #include "llvm/Option/ArgList.h"
18 #include "llvm/Support/FileSystem.h"
19 #include "llvm/Support/Path.h"
20 #include <system_error>
21 
22 using namespace clang::diag;
23 using namespace clang::driver;
24 using namespace clang;
25 using namespace llvm::opt;
26 
27 /// MinGW Tools
28 void tools::MinGW::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
29  const InputInfo &Output,
30  const InputInfoList &Inputs,
31  const ArgList &Args,
32  const char *LinkingOutput) const {
33  claimNoWarnArgs(Args);
34  ArgStringList CmdArgs;
35 
36  if (getToolChain().getArch() == llvm::Triple::x86) {
37  CmdArgs.push_back("--32");
38  } else if (getToolChain().getArch() == llvm::Triple::x86_64) {
39  CmdArgs.push_back("--64");
40  }
41 
42  Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
43 
44  CmdArgs.push_back("-o");
45  CmdArgs.push_back(Output.getFilename());
46 
47  for (const auto &II : Inputs)
48  CmdArgs.push_back(II.getFilename());
49 
50  const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
51  C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
52 
53  if (Args.hasArg(options::OPT_gsplit_dwarf))
54  SplitDebugInfo(getToolChain(), C, *this, JA, Args, Output,
55  SplitDebugName(Args, Inputs[0]));
56 }
57 
58 void tools::MinGW::Linker::AddLibGCC(const ArgList &Args,
59  ArgStringList &CmdArgs) const {
60  if (Args.hasArg(options::OPT_mthreads))
61  CmdArgs.push_back("-lmingwthrd");
62  CmdArgs.push_back("-lmingw32");
63 
64  // Make use of compiler-rt if --rtlib option is used
65  ToolChain::RuntimeLibType RLT = getToolChain().GetRuntimeLibType(Args);
66  if (RLT == ToolChain::RLT_Libgcc) {
67  bool Static = Args.hasArg(options::OPT_static_libgcc) ||
68  Args.hasArg(options::OPT_static);
69  bool Shared = Args.hasArg(options::OPT_shared);
70  bool CXX = getToolChain().getDriver().CCCIsCXX();
71 
72  if (Static || (!CXX && !Shared)) {
73  CmdArgs.push_back("-lgcc");
74  CmdArgs.push_back("-lgcc_eh");
75  } else {
76  CmdArgs.push_back("-lgcc_s");
77  CmdArgs.push_back("-lgcc");
78  }
79  } else {
80  AddRunTimeLibs(getToolChain(), getToolChain().getDriver(), CmdArgs, Args);
81  }
82 
83  CmdArgs.push_back("-lmoldname");
84  CmdArgs.push_back("-lmingwex");
85  for (auto Lib : Args.getAllArgValues(options::OPT_l))
86  if (StringRef(Lib).startswith("msvcr") || Lib == "ucrtbase")
87  return;
88  CmdArgs.push_back("-lmsvcrt");
89 }
90 
91 void tools::MinGW::Linker::ConstructJob(Compilation &C, const JobAction &JA,
92  const InputInfo &Output,
93  const InputInfoList &Inputs,
94  const ArgList &Args,
95  const char *LinkingOutput) const {
96  const ToolChain &TC = getToolChain();
97  const Driver &D = TC.getDriver();
98  // const SanitizerArgs &Sanitize = TC.getSanitizerArgs();
99 
100  ArgStringList CmdArgs;
101 
102  // Silence warning for "clang -g foo.o -o foo"
103  Args.ClaimAllArgs(options::OPT_g_Group);
104  // and "clang -emit-llvm foo.o -o foo"
105  Args.ClaimAllArgs(options::OPT_emit_llvm);
106  // and for "clang -w foo.o -o foo". Other warning options are already
107  // handled somewhere else.
108  Args.ClaimAllArgs(options::OPT_w);
109 
110  if (!D.SysRoot.empty())
111  CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
112 
113  if (Args.hasArg(options::OPT_s))
114  CmdArgs.push_back("-s");
115 
116  CmdArgs.push_back("-m");
117  switch (TC.getArch()) {
118  case llvm::Triple::x86:
119  CmdArgs.push_back("i386pe");
120  break;
121  case llvm::Triple::x86_64:
122  CmdArgs.push_back("i386pep");
123  break;
124  case llvm::Triple::arm:
125  case llvm::Triple::thumb:
126  // FIXME: this is incorrect for WinCE
127  CmdArgs.push_back("thumb2pe");
128  break;
129  case llvm::Triple::aarch64:
130  CmdArgs.push_back("arm64pe");
131  break;
132  default:
133  llvm_unreachable("Unsupported target architecture.");
134  }
135 
136  if (Args.hasArg(options::OPT_mwindows)) {
137  CmdArgs.push_back("--subsystem");
138  CmdArgs.push_back("windows");
139  } else if (Args.hasArg(options::OPT_mconsole)) {
140  CmdArgs.push_back("--subsystem");
141  CmdArgs.push_back("console");
142  }
143 
144  if (Args.hasArg(options::OPT_mdll))
145  CmdArgs.push_back("--dll");
146  else if (Args.hasArg(options::OPT_shared))
147  CmdArgs.push_back("--shared");
148  if (Args.hasArg(options::OPT_static))
149  CmdArgs.push_back("-Bstatic");
150  else
151  CmdArgs.push_back("-Bdynamic");
152  if (Args.hasArg(options::OPT_mdll) || Args.hasArg(options::OPT_shared)) {
153  CmdArgs.push_back("-e");
154  if (TC.getArch() == llvm::Triple::x86)
155  CmdArgs.push_back("_DllMainCRTStartup@12");
156  else
157  CmdArgs.push_back("DllMainCRTStartup");
158  CmdArgs.push_back("--enable-auto-image-base");
159  }
160 
161  CmdArgs.push_back("-o");
162  CmdArgs.push_back(Output.getFilename());
163 
164  Args.AddAllArgs(CmdArgs, options::OPT_e);
165  // FIXME: add -N, -n flags
166  Args.AddLastArg(CmdArgs, options::OPT_r);
167  Args.AddLastArg(CmdArgs, options::OPT_s);
168  Args.AddLastArg(CmdArgs, options::OPT_t);
169  Args.AddAllArgs(CmdArgs, options::OPT_u_Group);
170  Args.AddLastArg(CmdArgs, options::OPT_Z_Flag);
171 
172  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
173  if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_mdll)) {
174  CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("dllcrt2.o")));
175  } else {
176  if (Args.hasArg(options::OPT_municode))
177  CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crt2u.o")));
178  else
179  CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crt2.o")));
180  }
181  if (Args.hasArg(options::OPT_pg))
182  CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("gcrt2.o")));
183  CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtbegin.o")));
184  }
185 
186  Args.AddAllArgs(CmdArgs, options::OPT_L);
187  TC.AddFilePathLibArgs(Args, CmdArgs);
188  AddLinkerInputs(TC, Inputs, Args, CmdArgs, JA);
189 
190  // TODO: Add ASan stuff here
191 
192  // TODO: Add profile stuff here
193 
194  if (TC.ShouldLinkCXXStdlib(Args)) {
195  bool OnlyLibstdcxxStatic = Args.hasArg(options::OPT_static_libstdcxx) &&
196  !Args.hasArg(options::OPT_static);
197  if (OnlyLibstdcxxStatic)
198  CmdArgs.push_back("-Bstatic");
199  TC.AddCXXStdlibLibArgs(Args, CmdArgs);
200  if (OnlyLibstdcxxStatic)
201  CmdArgs.push_back("-Bdynamic");
202  }
203 
204  if (!Args.hasArg(options::OPT_nostdlib)) {
205  if (!Args.hasArg(options::OPT_nodefaultlibs)) {
206  if (Args.hasArg(options::OPT_static))
207  CmdArgs.push_back("--start-group");
208 
209  if (Args.hasArg(options::OPT_fstack_protector) ||
210  Args.hasArg(options::OPT_fstack_protector_strong) ||
211  Args.hasArg(options::OPT_fstack_protector_all)) {
212  CmdArgs.push_back("-lssp_nonshared");
213  CmdArgs.push_back("-lssp");
214  }
215  if (Args.hasArg(options::OPT_fopenmp))
216  CmdArgs.push_back("-lgomp");
217 
218  AddLibGCC(Args, CmdArgs);
219 
220  if (Args.hasArg(options::OPT_pg))
221  CmdArgs.push_back("-lgmon");
222 
223  if (Args.hasArg(options::OPT_pthread))
224  CmdArgs.push_back("-lpthread");
225 
226  // add system libraries
227  if (Args.hasArg(options::OPT_mwindows)) {
228  CmdArgs.push_back("-lgdi32");
229  CmdArgs.push_back("-lcomdlg32");
230  }
231  CmdArgs.push_back("-ladvapi32");
232  CmdArgs.push_back("-lshell32");
233  CmdArgs.push_back("-luser32");
234  CmdArgs.push_back("-lkernel32");
235 
236  if (Args.hasArg(options::OPT_static))
237  CmdArgs.push_back("--end-group");
238  else
239  AddLibGCC(Args, CmdArgs);
240  }
241 
242  if (!Args.hasArg(options::OPT_nostartfiles)) {
243  // Add crtfastmath.o if available and fast math is enabled.
244  TC.AddFastMathRuntimeIfAvailable(Args, CmdArgs);
245 
246  CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtend.o")));
247  }
248  }
249  const char *Exec = Args.MakeArgString(TC.GetLinkerPath());
250  C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
251 }
252 
253 // Simplified from Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple.
254 static bool findGccVersion(StringRef LibDir, std::string &GccLibDir,
255  std::string &Ver) {
256  auto Version = toolchains::Generic_GCC::GCCVersion::Parse("0.0.0");
257  std::error_code EC;
258  for (llvm::sys::fs::directory_iterator LI(LibDir, EC), LE; !EC && LI != LE;
259  LI = LI.increment(EC)) {
260  StringRef VersionText = llvm::sys::path::filename(LI->path());
261  auto CandidateVersion =
262  toolchains::Generic_GCC::GCCVersion::Parse(VersionText);
263  if (CandidateVersion.Major == -1)
264  continue;
265  if (CandidateVersion <= Version)
266  continue;
267  Ver = VersionText;
268  GccLibDir = LI->path();
269  }
270  return Ver.size();
271 }
272 
273 void toolchains::MinGW::findGccLibDir() {
275  Archs.emplace_back(getTriple().getArchName());
276  Archs[0] += "-w64-mingw32";
277  Archs.emplace_back("mingw32");
278  if (Arch.empty())
279  Arch = Archs[0].str();
280  // lib: Arch Linux, Ubuntu, Windows
281  // lib64: openSUSE Linux
282  for (StringRef CandidateLib : {"lib", "lib64"}) {
283  for (StringRef CandidateArch : Archs) {
285  llvm::sys::path::append(LibDir, CandidateLib, "gcc", CandidateArch);
286  if (findGccVersion(LibDir, GccLibDir, Ver)) {
287  Arch = CandidateArch;
288  return;
289  }
290  }
291  }
292 }
293 
294 llvm::ErrorOr<std::string> toolchains::MinGW::findGcc() {
296  Gccs.emplace_back(getTriple().getArchName());
297  Gccs[0] += "-w64-mingw32-gcc";
298  Gccs.emplace_back("mingw32-gcc");
299  // Please do not add "gcc" here
300  for (StringRef CandidateGcc : Gccs)
301  if (llvm::ErrorOr<std::string> GPPName = llvm::sys::findProgramByName(CandidateGcc))
302  return GPPName;
303  return make_error_code(std::errc::no_such_file_or_directory);
304 }
305 
306 llvm::ErrorOr<std::string> toolchains::MinGW::findClangRelativeSysroot() {
308  Subdirs.emplace_back(getTriple().str());
309  Subdirs.emplace_back(getTriple().getArchName());
310  Subdirs[1] += "-w64-mingw32";
311  StringRef ClangRoot =
312  llvm::sys::path::parent_path(getDriver().getInstalledDir());
313  StringRef Sep = llvm::sys::path::get_separator();
314  for (StringRef CandidateSubdir : Subdirs) {
315  if (llvm::sys::fs::is_directory(ClangRoot + Sep + CandidateSubdir)) {
316  Arch = CandidateSubdir;
317  return (ClangRoot + Sep + CandidateSubdir).str();
318  }
319  }
320  return make_error_code(std::errc::no_such_file_or_directory);
321 }
322 
323 toolchains::MinGW::MinGW(const Driver &D, const llvm::Triple &Triple,
324  const ArgList &Args)
325  : ToolChain(D, Triple, Args), CudaInstallation(D, Triple, Args) {
326  getProgramPaths().push_back(getDriver().getInstalledDir());
327 
328  if (getDriver().SysRoot.size())
329  Base = getDriver().SysRoot;
330  // Look for <clang-bin>/../<triplet>; if found, use <clang-bin>/.. as the
331  // base as it could still be a base for a gcc setup with libgcc.
332  else if (llvm::ErrorOr<std::string> TargetSubdir = findClangRelativeSysroot())
333  Base = llvm::sys::path::parent_path(TargetSubdir.get());
334  else if (llvm::ErrorOr<std::string> GPPName = findGcc())
335  Base = llvm::sys::path::parent_path(
336  llvm::sys::path::parent_path(GPPName.get()));
337  else
338  Base = llvm::sys::path::parent_path(getDriver().getInstalledDir());
339 
340  Base += llvm::sys::path::get_separator();
341  findGccLibDir();
342  // GccLibDir must precede Base/lib so that the
343  // correct crtbegin.o ,cetend.o would be found.
344  getFilePaths().push_back(GccLibDir);
345  getFilePaths().push_back(
346  (Base + Arch + llvm::sys::path::get_separator() + "lib").str());
347  getFilePaths().push_back(Base + "lib");
348  // openSUSE
349  getFilePaths().push_back(Base + Arch + "/sys-root/mingw/lib");
350 }
351 
353 
355  switch (AC) {
357  if (!Preprocessor)
358  Preprocessor.reset(new tools::gcc::Preprocessor(*this));
359  return Preprocessor.get();
361  if (!Compiler)
362  Compiler.reset(new tools::gcc::Compiler(*this));
363  return Compiler.get();
364  default:
365  return ToolChain::getTool(AC);
366  }
367 }
368 
370  return new tools::MinGW::Assembler(*this);
371 }
372 
374  return new tools::MinGW::Linker(*this);
375 }
376 
377 bool toolchains::MinGW::IsUnwindTablesDefault(const ArgList &Args) const {
378  return getArch() == llvm::Triple::x86_64;
379 }
380 
382  return getArch() == llvm::Triple::x86_64;
383 }
384 
385 bool toolchains::MinGW::isPIEDefault() const { return false; }
386 
388  return getArch() == llvm::Triple::x86_64;
389 }
390 
391 llvm::ExceptionHandling
392 toolchains::MinGW::GetExceptionModel(const ArgList &Args) const {
393  if (getArch() == llvm::Triple::x86_64)
394  return llvm::ExceptionHandling::WinEH;
395  return llvm::ExceptionHandling::DwarfCFI;
396 }
397 
398 void toolchains::MinGW::AddCudaIncludeArgs(const ArgList &DriverArgs,
399  ArgStringList &CC1Args) const {
400  CudaInstallation.AddCudaIncludeArgs(DriverArgs, CC1Args);
401 }
402 
403 void toolchains::MinGW::printVerboseInfo(raw_ostream &OS) const {
404  CudaInstallation.print(OS);
405 }
406 
407 // Include directories for various hosts:
408 
409 // Windows, mingw.org
410 // c:\mingw\lib\gcc\mingw32\4.8.1\include\c++
411 // c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\mingw32
412 // c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\backward
413 // c:\mingw\include
414 // c:\mingw\mingw32\include
415 
416 // Windows, mingw-w64 mingw-builds
417 // c:\mingw32\i686-w64-mingw32\include
418 // c:\mingw32\i686-w64-mingw32\include\c++
419 // c:\mingw32\i686-w64-mingw32\include\c++\i686-w64-mingw32
420 // c:\mingw32\i686-w64-mingw32\include\c++\backward
421 
422 // Windows, mingw-w64 msys2
423 // c:\msys64\mingw32\include
424 // c:\msys64\mingw32\i686-w64-mingw32\include
425 // c:\msys64\mingw32\include\c++\4.9.2
426 // c:\msys64\mingw32\include\c++\4.9.2\i686-w64-mingw32
427 // c:\msys64\mingw32\include\c++\4.9.2\backward
428 
429 // openSUSE
430 // /usr/lib64/gcc/x86_64-w64-mingw32/5.1.0/include/c++
431 // /usr/lib64/gcc/x86_64-w64-mingw32/5.1.0/include/c++/x86_64-w64-mingw32
432 // /usr/lib64/gcc/x86_64-w64-mingw32/5.1.0/include/c++/backward
433 // /usr/x86_64-w64-mingw32/sys-root/mingw/include
434 
435 // Arch Linux
436 // /usr/i686-w64-mingw32/include/c++/5.1.0
437 // /usr/i686-w64-mingw32/include/c++/5.1.0/i686-w64-mingw32
438 // /usr/i686-w64-mingw32/include/c++/5.1.0/backward
439 // /usr/i686-w64-mingw32/include
440 
441 // Ubuntu
442 // /usr/include/c++/4.8
443 // /usr/include/c++/4.8/x86_64-w64-mingw32
444 // /usr/include/c++/4.8/backward
445 // /usr/x86_64-w64-mingw32/include
446 
447 void toolchains::MinGW::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
448  ArgStringList &CC1Args) const {
449  if (DriverArgs.hasArg(options::OPT_nostdinc))
450  return;
451 
452  if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
453  SmallString<1024> P(getDriver().ResourceDir);
454  llvm::sys::path::append(P, "include");
455  addSystemInclude(DriverArgs, CC1Args, P.str());
456  }
457 
458  if (DriverArgs.hasArg(options::OPT_nostdlibinc))
459  return;
460 
461  if (GetRuntimeLibType(DriverArgs) == ToolChain::RLT_Libgcc) {
462  // openSUSE
463  addSystemInclude(DriverArgs, CC1Args,
464  Base + Arch + "/sys-root/mingw/include");
465  }
466 
467  addSystemInclude(DriverArgs, CC1Args,
468  Base + Arch + llvm::sys::path::get_separator() + "include");
469  addSystemInclude(DriverArgs, CC1Args, Base + "include");
470 }
471 
473  const ArgList &DriverArgs, ArgStringList &CC1Args) const {
474  if (DriverArgs.hasArg(options::OPT_nostdlibinc) ||
475  DriverArgs.hasArg(options::OPT_nostdincxx))
476  return;
477 
478  StringRef Slash = llvm::sys::path::get_separator();
479 
480  switch (GetCXXStdlibType(DriverArgs)) {
482  addSystemInclude(DriverArgs, CC1Args, Base + Arch + Slash + "include" +
483  Slash + "c++" + Slash + "v1");
484  addSystemInclude(DriverArgs, CC1Args,
485  Base + "include" + Slash + "c++" + Slash + "v1");
486  break;
487 
489  llvm::SmallVector<llvm::SmallString<1024>, 4> CppIncludeBases;
490  CppIncludeBases.emplace_back(Base);
491  llvm::sys::path::append(CppIncludeBases[0], Arch, "include", "c++");
492  CppIncludeBases.emplace_back(Base);
493  llvm::sys::path::append(CppIncludeBases[1], Arch, "include", "c++", Ver);
494  CppIncludeBases.emplace_back(Base);
495  llvm::sys::path::append(CppIncludeBases[2], "include", "c++", Ver);
496  CppIncludeBases.emplace_back(GccLibDir);
497  llvm::sys::path::append(CppIncludeBases[3], "include", "c++");
498  for (auto &CppIncludeBase : CppIncludeBases) {
499  addSystemInclude(DriverArgs, CC1Args, CppIncludeBase);
500  CppIncludeBase += Slash;
501  addSystemInclude(DriverArgs, CC1Args, CppIncludeBase + Arch);
502  addSystemInclude(DriverArgs, CC1Args, CppIncludeBase + "backward");
503  }
504  break;
505  }
506 }
void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Add the clang cc1 arguments for system include paths.
Definition: MinGW.cpp:447
static bool findGccVersion(StringRef LibDir, std::string &GccLibDir, std::string &Ver)
Definition: MinGW.cpp:254
Tool * getTool(Action::ActionClass AC) const override
Definition: MinGW.cpp:354
StringRef P
void AddRunTimeLibs(const ToolChain &TC, const Driver &D, llvm::opt::ArgStringList &CmdArgs, const llvm::opt::ArgList &Args)
std::string GetLinkerPath() const
Returns the linker path, respecting the -fuse-ld= argument to determine the linker suffix or name...
Definition: ToolChain.cpp:411
void print(raw_ostream &OS) const
Print information about the detected CUDA installation.
Definition: Cuda.cpp:272
const char * getFilename() const
Definition: InputInfo.h:84
bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override
IsUnwindTablesDefault - Does this tool chain use -funwind-tables by default.
Definition: MinGW.cpp:377
path_list & getProgramPaths()
Definition: ToolChain.h:219
Tool * buildLinker() const override
Definition: MinGW.cpp:373
bool isPIEDefault() const override
Test whether this toolchain defaults to PIE.
Definition: MinGW.cpp:385
std::error_code make_error_code(BuildPreambleError Error)
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:23
std::string GetFilePath(const char *Name) const
Definition: ToolChain.cpp:403
path_list & getFilePaths()
Definition: ToolChain.h:216
virtual 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:762
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:59
llvm::ExceptionHandling GetExceptionModel(const llvm::opt::ArgList &Args) const override
GetExceptionModel - Return the tool chain exception model.
Definition: MinGW.cpp:392
void printVerboseInfo(raw_ostream &OS) const override
Dispatch to the specific toolchain for verbose printing.
Definition: MinGW.cpp:403
Tool * buildAssembler() const override
Definition: MinGW.cpp:369
const char * SplitDebugName(const llvm::opt::ArgList &Args, const InputInfo &Input)
void addCommand(std::unique_ptr< Command > C)
Definition: Compilation.h:206
llvm::Triple::ArchType getArch() const
Definition: ToolChain.h:197
void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
Definition: Cuda.cpp:229
bool isPICDefaultForced() const override
Tests whether this toolchain forces its default for PIC, PIE or non-PIC.
Definition: MinGW.cpp:387
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:750
const Driver & getDriver() const
Definition: ToolChain.h:181
void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Add arguments to use system-specific CUDA includes.
Definition: MinGW.cpp:398
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:674
void SplitDebugInfo(const ToolChain &TC, Compilation &C, const Tool &T, const JobAction &JA, const llvm::opt::ArgList &Args, const InputInfo &Output, const char *OutFile)
virtual RuntimeLibType GetRuntimeLibType(const llvm::opt::ArgList &Args) const
Definition: ToolChain.cpp:636
bool ShouldLinkCXXStdlib(const llvm::opt::ArgList &Args) const
Returns if the C++ standard library should be linked in.
Definition: ToolChain.cpp:727
Dataflow Directional Tag Classes.
void AddLinkerInputs(const ToolChain &TC, const InputInfoList &Inputs, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const JobAction &JA)
std::string SysRoot
sysroot, if present
Definition: Driver.h:149
Tool - Information on a specific compilation tool.
Definition: Tool.h:34
void claimNoWarnArgs(const llvm::opt::ArgList &Args)
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:46
virtual Tool * getTool(Action::ActionClass AC) const
Definition: ToolChain.cpp:275
virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const
Definition: ToolChain.cpp:655
bool IsIntegratedAssemblerDefault() const override
IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as by default.
Definition: MinGW.cpp:352
bool isPICDefault() const override
Test whether this toolchain defaults to PIC.
Definition: MinGW.cpp:381
void AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
AddClangCXXStdlibIncludeArgs - Add the clang -cc1 level arguments to set the include paths to use for...
Definition: MinGW.cpp:472
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:733
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Definition: Preprocessor.h:127
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:88