Lines Matching +full:diag +full:- +full:version

1 //===- ToolChain.cpp - Collections of tools for one platform --------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
32 #include "llvm/Config/llvm-config.h"
67 // Explicit rtti/no-rtti args in CalculateRTTIMode()
69 if (CachedRTTIArg->getOption().matches(options::OPT_frtti)) in CalculateRTTIMode()
75 // -frtti is default, except for the PS4/PS5 and DriverKit. in CalculateRTTIMode()
110 llvm::sys::fs::createTemporaryFile("toolchain-program", "txt", OutputFile); in executeToolChainProgram()
155 "(Non-)integrated backend set incorrectly!"); in useIntegratedBackend()
161 // Diagnose when integrated-objemitter options are not supported by this in useIntegratedBackend()
166 DiagID = clang::diag::err_drv_unsupported_opt_for_target; in useIntegratedBackend()
168 DiagID = clang::diag::warn_drv_unsupported_opt_for_target; in useIntegratedBackend()
171 D.Diag(DiagID) << A->getAsString(Args) << Triple.getTriple(); in useIntegratedBackend()
174 D.Diag(DiagID) << A->getAsString(Args) << Triple.getTriple(); in useIntegratedBackend()
207 if (FeatureSet.contains(ArchInfo->ArchFeature)) in getAArch64MultilibFlags()
208 ArchName = ArchInfo->Name; in getAArch64MultilibFlags()
210 MArch.insert(MArch.begin(), ("-march=" + ArchName).str()); in getAArch64MultilibFlags()
233 MArch.insert(MArch.begin(), ("-march=" + Triple.getArchName()).str()); in getARMMultilibFlags()
237 #define ARM_FPU(NAME, KIND, VERSION, NEON_SUPPORT, RESTRICTION) \ in getARMMultilibFlags() argument
239 Result.push_back("-mfpu=" NAME); \ in getARMMultilibFlags()
248 Result.push_back("-mfloat-abi=soft"); in getARMMultilibFlags()
251 Result.push_back("-mfloat-abi=softfp"); in getARMMultilibFlags()
254 Result.push_back("-mfloat-abi=hard"); in getARMMultilibFlags()
267 Result.push_back("--target=" + Triple.str()); in getMultilibFlags()
285 // Include fno-exceptions and fno-rtti in getMultilibFlags()
288 Result.push_back("-fno-rtti"); in getMultilibFlags()
290 Result.push_back("-frtti"); in getMultilibFlags()
293 Result.push_back("-fno-exceptions"); in getMultilibFlags()
295 Result.push_back("-fexceptions"); in getMultilibFlags()
331 {"clang++", "--driver-mode=g++"}, in FindDriverSuffix()
332 {"clang-c++", "--driver-mode=g++"}, in FindDriverSuffix()
333 {"clang-cc", nullptr}, in FindDriverSuffix()
334 {"clang-cpp", "--driver-mode=cpp"}, in FindDriverSuffix()
335 {"clang-g++", "--driver-mode=g++"}, in FindDriverSuffix()
336 {"clang-gcc", nullptr}, in FindDriverSuffix()
337 {"clang-cl", "--driver-mode=cl"}, in FindDriverSuffix()
339 {"cpp", "--driver-mode=cpp"}, in FindDriverSuffix()
340 {"cl", "--driver-mode=cl"}, in FindDriverSuffix()
341 {"++", "--driver-mode=g++"}, in FindDriverSuffix()
342 {"flang", "--driver-mode=flang"}, in FindDriverSuffix()
343 {"clang-dxc", "--driver-mode=dxc"}, in FindDriverSuffix()
349 Pos = ProgName.size() - Suffix.size(); in FindDriverSuffix()
357 /// present and lower-casing the string on Windows.
373 // E.g. "x86_64-linux-clang" as interpreted as suffix "clang" with target in parseDriverSuffix()
374 // prefix "x86_64-linux". If such a target prefix is found, it may be in parseDriverSuffix()
375 // added via -target as implicit first argument. in parseDriverSuffix()
380 // clang++.exe -> clang++ in parseDriverSuffix()
386 // Try again after stripping any trailing version number: in parseDriverSuffix()
387 // clang++3.5 -> clang++ in parseDriverSuffix()
393 // Try again after stripping trailing -component. in parseDriverSuffix()
394 // clang++-tot -> clang++ in parseDriverSuffix()
395 ProgName = ProgName.slice(0, ProgName.rfind('-')); in parseDriverSuffix()
408 size_t SuffixEnd = SuffixPos + strlen(DS->Suffix); in getTargetAndModeFromProgramName()
410 size_t LastComponent = ProgName.rfind('-', SuffixPos); in getTargetAndModeFromProgramName()
412 return ParsedClangName(ProgName.substr(0, SuffixEnd), DS->ModeFlag); in getTargetAndModeFromProgramName()
414 SuffixEnd - LastComponent - 1); in getTargetAndModeFromProgramName()
422 return ParsedClangName{std::string(Prefix), ModeSuffix, DS->ModeFlag, in getTargetAndModeFromProgramName()
427 // In universal driver terms, the arch name accepted by -arch isn't exactly in getDefaultUniversalArchName()
671 const char *Env = TT.isAndroid() ? "-android" : ""; in buildCompilerRTBasename()
672 ArchAndEnv = ("-" + Arch + Env).str(); in buildCompilerRTBasename()
714 // Android target triples contain a target version. If we don't have libraries
715 // for the exact target version, we should fall back to the next newest version
720 TripleWithoutLevel.setEnvironmentName("android"); // remove any version number in getFallbackAndroidTargetPath()
730 StringRef DirName = llvm::sys::path::filename(LI->path()); in getFallbackAndroidTargetPath()
737 unsigned Version; in getFallbackAndroidTargetPath() local
738 if (!DirNameSuffix.getAsInteger(10, Version) && Version > BestVersion && in getFallbackAndroidTargetPath()
739 Version < TripleVersion) { in getFallbackAndroidTargetPath()
740 BestVersion = Version; in getFallbackAndroidTargetPath()
754 D.Diag(diag::warn_android_unversioned_fallback) << P << getTripleString(); in getFallbackAndroidTargetPath()
761 [&](const llvm::Triple &Triple) -> std::optional<std::string> { in getTargetSubDirPath()
778 // Original triple: armv8l-unknown-linux-gnueabihf in getTargetSubDirPath()
779 // Runtime triple: arm-unknown-linux-gnueabihf in getTargetSubDirPath()
805 // Darwin does not use per-target runtime directory. in getRuntimePath()
882 // Get -fuse-ld= first to prevent -Wunused-command-line-argument. -fuse-ld= is in GetLinkerPath()
885 StringRef UseLinker = A ? A->getValue() : CLANG_DEFAULT_LINKER; in GetLinkerPath()
887 // --ld-path= takes precedence over -fuse-ld= and specifies the executable in GetLinkerPath()
888 // name. -B, COMPILER_PATH and PATH and consulted if the value does not in GetLinkerPath()
890 // -fuse-ld=lld can be used with --ld-path= to inform clang that the binary in GetLinkerPath()
891 // that --ld-path= points to is lld. in GetLinkerPath()
893 std::string Path(A->getValue()); in GetLinkerPath()
896 Path = GetProgramPath(A->getValue()); in GetLinkerPath()
903 getDriver().Diag(diag::err_drv_invalid_linker_name) << A->getAsString(Args); in GetLinkerPath()
906 // If we're passed -fuse-ld= with no argument, or with the argument ld, in GetLinkerPath()
916 // Extending -fuse-ld= to an absolute or relative path is unexpected. Checking in GetLinkerPath()
919 // among -B, COMPILER_PATH and PATH. --ld-path= should be used instead. in GetLinkerPath()
921 getDriver().Diag(diag::warn_drv_fuse_ld_path); in GetLinkerPath()
925 // second-guess that. in GetLinkerPath()
945 getDriver().Diag(diag::err_drv_invalid_linker_name) << A->getAsString(Args); in GetLinkerPath()
954 return GetProgramPath("llvm-ar"); in GetStaticLibToolPath()
1024 // x86_64h goes in the triple. Other -march options just use the in ComputeLLVMTriple()
1026 StringRef MArch = A->getValue(); in ComputeLLVMTriple()
1098 StringRef LibName = A ? A->getValue() : CLANG_DEFAULT_RTLIB; in GetRuntimeLibType()
1101 if (LibName == "compiler-rt") in GetRuntimeLibType()
1109 getDriver().Diag(diag::err_drv_invalid_rtlib_name) in GetRuntimeLibType()
1110 << A->getAsString(Args); in GetRuntimeLibType()
1124 StringRef LibName = A ? A->getValue() : CLANG_DEFAULT_UNWINDLIB; in GetUnwindLibType()
1139 getDriver().Diag(diag::err_drv_incompatible_unwindlib); in GetUnwindLibType()
1145 getDriver().Diag(diag::err_drv_invalid_unwindlib_name) in GetUnwindLibType()
1146 << A->getAsString(Args); in GetUnwindLibType()
1159 StringRef LibName = A ? A->getValue() : CLANG_DEFAULT_CXX_STDLIB; in GetCXXStdlibType()
1170 getDriver().Diag(diag::err_drv_invalid_stdlib_name) in GetCXXStdlibType()
1171 << A->getAsString(Args); in GetCXXStdlibType()
1183 CC1Args.push_back("-internal-isystem"); in addSystemInclude()
1198 CC1Args.push_back("-internal-externc-isystem"); in addExternCSystemInclude()
1214 CC1Args.push_back("-internal-isystem"); in addSystemIncludes()
1235 StringRef VersionText = llvm::sys::path::filename(LI->path()); in detectLibcxxVersion()
1236 int Version; in detectLibcxxVersion() local
1238 !VersionText.slice(1, StringRef::npos).getAsInteger(10, Version)) { in detectLibcxxVersion()
1239 if (Version > MaxVersion) { in detectLibcxxVersion()
1240 MaxVersion = Version; in detectLibcxxVersion()
1254 // the CC1-layer frontend. As the logic is hoisted out, this generic function in AddClangCXXStdlibIncludeArgs()
1258 // '-stdlib=' flag down to CC1 so that it can in turn customize the C++ in AddClangCXXStdlibIncludeArgs()
1268 // This intentionally only looks at -nostdinc++, and not -nostdinc or in AddClangCXXStdlibIsystemArgs()
1269 // -nostdlibinc. The purpose of -stdlib++-isystem is to support toolchain in AddClangCXXStdlibIsystemArgs()
1270 // setups with non-standard search logic for the C++ headers, while still in AddClangCXXStdlibIsystemArgs()
1272 // toolchain likely also has non-standard search logic for the C headers and in AddClangCXXStdlibIsystemArgs()
1273 // uses -nostdinc to suppress the default logic, but -stdlib++-isystem should in AddClangCXXStdlibIsystemArgs()
1274 // still work in that case and only be suppressed by an explicit -nostdinc++ in AddClangCXXStdlibIsystemArgs()
1296 CmdArgs.push_back("-lc++"); in AddCXXStdlibLibArgs()
1298 CmdArgs.push_back("-lc++experimental"); in AddCXXStdlibLibArgs()
1302 CmdArgs.push_back("-lstdc++"); in AddCXXStdlibLibArgs()
1311 CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath)); in AddFilePathLibArgs()
1316 CmdArgs.push_back("-lcc_kext"); in AddCCKextLibArgs()
1321 // Don't implicitly link in mode-changing libraries in a shared library, since in isFastMathRuntimeAvailable()
1323 // https://github.com/llvm/llvm-project/issues/57589 for more information. in isFastMathRuntimeAvailable()
1326 // Do not check for -fno-fast-math or -fno-unsafe-math when -Ofast passed in isFastMathRuntimeAvailable()
1329 // Check if -ffast-math or -funsafe-math. in isFastMathRuntimeAvailable()
1335 if (!A || A->getOption().getID() == options::OPT_fno_fast_math || in isFastMathRuntimeAvailable()
1336 A->getOption().getID() == options::OPT_fno_unsafe_math_optimizations) in isFastMathRuntimeAvailable()
1338 if (A && A->getOption().getID() == options::OPT_ffp_model_EQ) { in isFastMathRuntimeAvailable()
1339 StringRef Model = A->getValue(); in isFastMathRuntimeAvailable()
1346 // -mdaz-ftz or -mno-daz-ftz is capable of overriding it. in isFastMathRuntimeAvailable()
1410 static VersionTuple separateMSVCFullVersion(unsigned Version) { in separateMSVCFullVersion() argument
1411 if (Version < 100) in separateMSVCFullVersion()
1412 return VersionTuple(Version); in separateMSVCFullVersion()
1414 if (Version < 10000) in separateMSVCFullVersion()
1415 return VersionTuple(Version / 100, Version % 100); in separateMSVCFullVersion()
1418 for (; Version > 10000; Version = Version / 10, Factor = Factor * 10) in separateMSVCFullVersion()
1419 Build = Build + (Version % 10) * Factor; in separateMSVCFullVersion()
1420 return VersionTuple(Version / 100, Version % 100, Build); in separateMSVCFullVersion()
1432 D->Diag(diag::err_drv_argument_not_allowed_with) in computeMSVCVersion()
1433 << MSCVersion->getAsString(Args) in computeMSVCVersion()
1434 << MSCompatibilityVersion->getAsString(Args); in computeMSVCVersion()
1440 if (MSVT.tryParse(MSCompatibilityVersion->getValue())) { in computeMSVCVersion()
1442 D->Diag(diag::err_drv_invalid_value) in computeMSVCVersion()
1443 << MSCompatibilityVersion->getAsString(Args) in computeMSVCVersion()
1444 << MSCompatibilityVersion->getValue(); in computeMSVCVersion()
1451 unsigned Version = 0; in computeMSVCVersion() local
1452 if (StringRef(MSCVersion->getValue()).getAsInteger(10, Version)) { in computeMSVCVersion()
1454 D->Diag(diag::err_drv_invalid_value) in computeMSVCVersion()
1455 << MSCVersion->getAsString(Args) << MSCVersion->getValue(); in computeMSVCVersion()
1457 return separateMSVCFullVersion(Version); in computeMSVCVersion()
1471 // Handle -Xopenmp-target flags in TranslateOpenMPTargetArgs()
1477 if (A->getOption().matches(options::OPT_m_Group)) { in TranslateOpenMPTargetArgs()
1478 // Pass code object version to device toolchain in TranslateOpenMPTargetArgs()
1481 A->getOption().matches(options::OPT_mcode_object_version_EQ)) in TranslateOpenMPTargetArgs()
1482 DAL->append(A); in TranslateOpenMPTargetArgs()
1491 A->getOption().matches(options::OPT_Xopenmp_target); in TranslateOpenMPTargetArgs()
1493 if (A->getOption().matches(options::OPT_Xopenmp_target_EQ)) { in TranslateOpenMPTargetArgs()
1494 llvm::Triple TT(getOpenMPTriple(A->getValue(0))); in TranslateOpenMPTargetArgs()
1496 // Passing device args: -Xopenmp-target=<triple> -opt=val. in TranslateOpenMPTargetArgs()
1498 Index = Args.getBaseArgs().MakeIndex(A->getValue(1)); in TranslateOpenMPTargetArgs()
1502 // Passing device args: -Xopenmp-target -opt=val. in TranslateOpenMPTargetArgs()
1503 Index = Args.getBaseArgs().MakeIndex(A->getValue(0)); in TranslateOpenMPTargetArgs()
1505 DAL->append(A); in TranslateOpenMPTargetArgs()
1509 // Parse the argument to -Xopenmp-target. in TranslateOpenMPTargetArgs()
1513 getDriver().Diag(diag::err_drv_invalid_Xopenmp_target_with_args) in TranslateOpenMPTargetArgs()
1514 << A->getAsString(Args); in TranslateOpenMPTargetArgs()
1519 getDriver().Diag(diag::err_drv_Xopenmp_target_missing_triple); in TranslateOpenMPTargetArgs()
1522 XOpenMPTargetArg->setBaseArg(A); in TranslateOpenMPTargetArgs()
1525 DAL->append(A); in TranslateOpenMPTargetArgs()
1537 // -Xclang -mframe-pointer=no cannot be passed by -Xarch_. This should be
1545 if (A->getOption().matches(options::OPT_Xarch_device) || in TranslateXarchArgs()
1546 A->getOption().matches(options::OPT_Xarch_host)) in TranslateXarchArgs()
1549 unsigned Index = Args.getBaseArgs().MakeIndex(A->getValue(ValuePos)); in TranslateXarchArgs()
1554 // consumed, the -Xarch_ argument's parameter tried to consume in TranslateXarchArgs()
1561 getDriver().Diag(diag::err_drv_invalid_Xarch_argument_with_args) in TranslateXarchArgs()
1562 << A->getAsString(Args); in TranslateXarchArgs()
1564 } else if (XarchArg->getOption().hasFlag(options::NoXarchOption)) { in TranslateXarchArgs()
1570 Diags.Report(DiagID) << A->getAsString(Args); in TranslateXarchArgs()
1573 XarchArg->setBaseArg(A); in TranslateXarchArgs()
1576 DAL->AddSynthesizedArg(A); in TranslateXarchArgs()
1578 AllocatedArgs->push_back(A); in TranslateXarchArgs()
1592 if (A->getOption().matches(options::OPT_Xarch_device)) { in TranslateXarchArgs()
1595 } else if (A->getOption().matches(options::OPT_Xarch_host)) { in TranslateXarchArgs()
1598 } else if (A->getOption().matches(options::OPT_Xarch__) && IsDevice) { in TranslateXarchArgs()
1599 // Do not translate -Xarch_ options for non CUDA/HIP toolchain since in TranslateXarchArgs()
1602 if (BoundArch.empty() || A->getValue(0) != BoundArch) in TranslateXarchArgs()
1612 DAL->append(A); in TranslateXarchArgs()