• Home
  • Raw
  • Download

Lines Matching +full:- +full:- +full:toolchain

1 //===--- ToolChain.cpp - Collections of tools for one platform ------------===//
8 //===----------------------------------------------------------------------===//
18 #include "clang/Driver/ToolChain.h"
40 static ToolChain::RTTIMode CalculateRTTIMode(const ArgList &Args, in CalculateRTTIMode()
43 // Explicit rtti/no-rtti args in CalculateRTTIMode()
45 if (CachedRTTIArg->getOption().matches(options::OPT_frtti)) in CalculateRTTIMode()
46 return ToolChain::RM_EnabledExplicitly; in CalculateRTTIMode()
48 return ToolChain::RM_DisabledExplicitly; in CalculateRTTIMode()
51 // -frtti is default, except for the PS4 CPU. in CalculateRTTIMode()
53 return ToolChain::RM_EnabledImplicitly; in CalculateRTTIMode()
56 // We're assuming that, if we see -fexceptions, rtti gets turned on. in CalculateRTTIMode()
61 (Exceptions->getOption().matches(options::OPT_fexceptions) || in CalculateRTTIMode()
62 Exceptions->getOption().matches(options::OPT_fcxx_exceptions))) in CalculateRTTIMode()
63 return ToolChain::RM_EnabledImplicitly; in CalculateRTTIMode()
65 return ToolChain::RM_DisabledImplicitly; in CalculateRTTIMode()
68 ToolChain::ToolChain(const Driver &D, const llvm::Triple &T, in ToolChain() function in ToolChain
73 if (!isThreadModelSupported(A->getValue())) in ToolChain()
75 << A->getValue() << A->getAsString(Args); in ToolChain()
78 ToolChain::~ToolChain() { in ~ToolChain()
81 vfs::FileSystem &ToolChain::getVFS() const { return getDriver().getVFS(); } in getVFS()
83 bool ToolChain::useIntegratedAs() const { in useIntegratedAs()
89 const SanitizerArgs& ToolChain::getSanitizerArgs() const { in getSanitizerArgs()
107 {"clang++", "--driver-mode=g++"}, in FindDriverSuffix()
108 {"clang-c++", "--driver-mode=g++"}, in FindDriverSuffix()
109 {"clang-cc", nullptr}, in FindDriverSuffix()
110 {"clang-cpp", "--driver-mode=cpp"}, in FindDriverSuffix()
111 {"clang-g++", "--driver-mode=g++"}, in FindDriverSuffix()
112 {"clang-gcc", nullptr}, in FindDriverSuffix()
113 {"clang-cl", "--driver-mode=cl"}, in FindDriverSuffix()
115 {"cpp", "--driver-mode=cpp"}, in FindDriverSuffix()
116 {"cl", "--driver-mode=cl"}, in FindDriverSuffix()
117 {"++", "--driver-mode=g++"}, in FindDriverSuffix()
127 /// present and lower-casing the string on Windows.
142 // E.g. "x86_64-linux-clang" as interpreted as suffix "clang" with target in parseDriverSuffix()
143 // prefix "x86_64-linux". If such a target prefix is found, it may be in parseDriverSuffix()
144 // added via -target as implicit first argument. in parseDriverSuffix()
149 // clang++3.5 -> clang++ in parseDriverSuffix()
155 // Try again after stripping trailing -component. in parseDriverSuffix()
156 // clang++-tot -> clang++ in parseDriverSuffix()
157 ProgName = ProgName.slice(0, ProgName.rfind('-')); in parseDriverSuffix()
165 ToolChain::getTargetAndModeFromProgramName(StringRef PN) { in getTargetAndModeFromProgramName()
170 std::string ModeFlag = DS->ModeFlag == nullptr ? "" : DS->ModeFlag; in getTargetAndModeFromProgramName()
173 ProgName.rfind('-', ProgName.size() - strlen(DS->Suffix)); in getTargetAndModeFromProgramName()
188 StringRef ToolChain::getDefaultUniversalArchName() const { in getDefaultUniversalArchName()
189 // In universal driver terms, the arch name accepted by -arch isn't exactly in getDefaultUniversalArchName()
205 bool ToolChain::IsUnwindTablesDefault() const { in IsUnwindTablesDefault()
209 Tool *ToolChain::getClang() const { in getClang()
215 Tool *ToolChain::buildAssembler() const { in buildAssembler()
219 Tool *ToolChain::buildLinker() const { in buildLinker()
220 llvm_unreachable("Linking is not supported by this toolchain"); in buildLinker()
223 Tool *ToolChain::getAssemble() const { in getAssemble()
229 Tool *ToolChain::getClangAs() const { in getClangAs()
235 Tool *ToolChain::getLink() const { in getLink()
241 Tool *ToolChain::getTool(Action::ActionClass AC) const { in getTool()
271 static StringRef getArchNameForCompilerRTLib(const ToolChain &TC, in getArchNameForCompilerRTLib()
287 std::string ToolChain::getCompilerRT(const ArgList &Args, StringRef Component, in getCompilerRT()
290 const char *Env = TT.isAndroid() ? "-android" : ""; in getCompilerRT()
302 llvm::sys::path::append(Path, Prefix + Twine("clang_rt.") + Component + "-" + in getCompilerRT()
307 const char *ToolChain::getCompilerRTArgString(const llvm::opt::ArgList &Args, in getCompilerRTArgString()
313 bool ToolChain::needsProfileRT(const ArgList &Args) { in needsProfileRT()
327 Tool *ToolChain::SelectTool(const JobAction &JA) const { in SelectTool()
335 std::string ToolChain::GetFilePath(const char *Name) const { in GetFilePath()
339 std::string ToolChain::GetProgramPath(const char *Name) const { in GetProgramPath()
343 std::string ToolChain::GetLinkerPath() const { in GetLinkerPath()
345 StringRef UseLinker = A->getValue(); in GetLinkerPath()
348 // If we're passed -fuse-ld= with what looks like an absolute path, in GetLinkerPath()
349 // don't attempt to second-guess that. in GetLinkerPath()
353 // If we're passed -fuse-ld= with no argument, or with the argument ld, in GetLinkerPath()
366 getDriver().Diag(diag::err_drv_invalid_linker_name) << A->getAsString(Args); in GetLinkerPath()
373 types::ID ToolChain::LookupTypeForExtension(const char *Ext) const { in LookupTypeForExtension()
377 bool ToolChain::HasNativeLLVMSupport() const { in HasNativeLLVMSupport()
381 bool ToolChain::isCrossCompiling() const { in isCrossCompiling()
397 ObjCRuntime ToolChain::getDefaultObjCRuntime(bool isNonFragile) const { in getDefaultObjCRuntime()
402 bool ToolChain::isThreadModelSupported(const StringRef Model) const { in isThreadModelSupported()
417 std::string ToolChain::ComputeLLVMTriple(const ArgList &Args, in ComputeLLVMTriple()
429 // x86_64h goes in the triple. Other -march options just use the in ComputeLLVMTriple()
431 StringRef MArch = A->getValue(); in ComputeLLVMTriple()
457 // Handle pseudo-target flags '-mlittle-endian'/'-EL' and in ComputeLLVMTriple()
458 // '-mbig-endian'/'-EB'. in ComputeLLVMTriple()
461 IsBigEndian = !A->getOption().matches(options::OPT_mlittle_endian); in ComputeLLVMTriple()
466 // FIXME: Thumb should just be another -target-feaure, not in the triple. in ComputeLLVMTriple()
469 MCPU = A->getValue(); in ComputeLLVMTriple()
471 MArch = A->getValue(); in ComputeLLVMTriple()
490 // Assembly files should start in ARM mode, unless arch is M-profile. in ComputeLLVMTriple()
505 std::string ToolChain::ComputeEffectiveClangTriple(const ArgList &Args, in ComputeEffectiveClangTriple()
510 void ToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs, in AddClangSystemIncludeArgs()
512 // Each toolchain should provide the appropriate include flags. in AddClangSystemIncludeArgs()
515 void ToolChain::addClangTargetOptions(const ArgList &DriverArgs, in addClangTargetOptions()
519 void ToolChain::addClangWarningOptions(ArgStringList &CC1Args) const {} in addClangWarningOptions()
521 void ToolChain::addProfileRTLibs(const llvm::opt::ArgList &Args, in addProfileRTLibs()
528 ToolChain::RuntimeLibType ToolChain::GetRuntimeLibType( in GetRuntimeLibType()
531 StringRef Value = A->getValue(); in GetRuntimeLibType()
532 if (Value == "compiler-rt") in GetRuntimeLibType()
533 return ToolChain::RLT_CompilerRT; in GetRuntimeLibType()
535 return ToolChain::RLT_Libgcc; in GetRuntimeLibType()
537 << A->getAsString(Args); in GetRuntimeLibType()
544 ToolChain::CXXStdlibType& Type) { in ParseCXXStdlibType()
546 Type = ToolChain::CST_Libcxx; in ParseCXXStdlibType()
548 Type = ToolChain::CST_Libstdcxx; in ParseCXXStdlibType()
555 ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{ in GetCXXStdlibType()
556 ToolChain::CXXStdlibType Type; in GetCXXStdlibType()
562 StringRef Value = A->getValue(); in GetCXXStdlibType()
570 << A->getAsString(Args); in GetCXXStdlibType()
581 /*static*/ void ToolChain::addSystemInclude(const ArgList &DriverArgs, in addSystemInclude()
584 CC1Args.push_back("-internal-isystem"); in addSystemInclude()
596 /*static*/ void ToolChain::addExternCSystemInclude(const ArgList &DriverArgs, in addExternCSystemInclude()
599 CC1Args.push_back("-internal-externc-isystem"); in addExternCSystemInclude()
603 void ToolChain::addExternCSystemIncludeIfExists(const ArgList &DriverArgs, in addExternCSystemIncludeIfExists()
611 /*static*/ void ToolChain::addSystemIncludes(const ArgList &DriverArgs, in addSystemIncludes()
615 CC1Args.push_back("-internal-isystem"); in addSystemIncludes()
620 void ToolChain::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, in AddClangCXXStdlibIncludeArgs()
624 // the CC1-layer frontend. As the logic is hoisted out, this generic function in AddClangCXXStdlibIncludeArgs()
628 // '-stdlib=' flag down to CC1 so that it can in turn customize the C++ in AddClangCXXStdlibIncludeArgs()
634 void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args, in AddCXXStdlibLibArgs()
639 case ToolChain::CST_Libcxx: in AddCXXStdlibLibArgs()
640 CmdArgs.push_back("-lc++"); in AddCXXStdlibLibArgs()
643 case ToolChain::CST_Libstdcxx: in AddCXXStdlibLibArgs()
644 CmdArgs.push_back("-lstdc++"); in AddCXXStdlibLibArgs()
649 void ToolChain::AddFilePathLibArgs(const ArgList &Args, in AddFilePathLibArgs()
653 CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath)); in AddFilePathLibArgs()
656 void ToolChain::AddCCKextLibArgs(const ArgList &Args, in AddCCKextLibArgs()
658 CmdArgs.push_back("-lcc_kext"); in AddCCKextLibArgs()
661 bool ToolChain::AddFastMathRuntimeIfAvailable(const ArgList &Args, in AddFastMathRuntimeIfAvailable()
663 // Do not check for -fno-fast-math or -fno-unsafe-math when -Ofast passed in AddFastMathRuntimeIfAvailable()
666 // Check if -ffast-math or -funsafe-math. in AddFastMathRuntimeIfAvailable()
672 if (!A || A->getOption().getID() == options::OPT_fno_fast_math || in AddFastMathRuntimeIfAvailable()
673 A->getOption().getID() == options::OPT_fno_unsafe_math_optimizations) in AddFastMathRuntimeIfAvailable()
685 SanitizerMask ToolChain::getSupportedSanitizers() const { in getSupportedSanitizers()
697 void ToolChain::AddCudaIncludeArgs(const ArgList &DriverArgs, in AddCudaIncludeArgs()
700 void ToolChain::AddIAMCUIncludeArgs(const ArgList &DriverArgs, in AddIAMCUIncludeArgs()