Author: Tom Weaver Date: 2021-02-10T16:37:34Z New Revision: a743702a1f4880e4492196b1ce9a9a63e0b4c075
URL: https://github.com/llvm/llvm-project/commit/a743702a1f4880e4492196b1ce9a9a63e0b4c075 DIFF: https://github.com/llvm/llvm-project/commit/a743702a1f4880e4492196b1ce9a9a63e0b4c075.diff LOG: Revert "[clang][driver] Only warn once about invalid library values" This reverts commit a6439b52088b1d58d8e7aa9891c9011648710593. Caused buildbot failure http://lab.llvm.org:8014/#/builders/125/builds/125 Added: Modified: clang/include/clang/Driver/ToolChain.h clang/lib/Driver/ToolChain.cpp Removed: ################################################################################ diff --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver/ToolChain.h index fed688c0f1ce..59fdd2997fec 100644 --- a/clang/include/clang/Driver/ToolChain.h +++ b/clang/include/clang/Driver/ToolChain.h @@ -166,10 +166,6 @@ class ToolChain { EffectiveTriple = std::move(ET); } - mutable llvm::Optional<CXXStdlibType> cxxStdlibType; - mutable llvm::Optional<RuntimeLibType> runtimeLibType; - mutable llvm::Optional<UnwindLibType> unwindLibType; - protected: MultilibSet Multilibs; Multilib SelectedMultilib; diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp index d0f404d8cbaa..c83638086048 100644 --- a/clang/lib/Driver/ToolChain.cpp +++ b/clang/lib/Driver/ToolChain.cpp @@ -884,86 +884,66 @@ void ToolChain::addProfileRTLibs(const llvm::opt::ArgList &Args, ToolChain::RuntimeLibType ToolChain::GetRuntimeLibType( const ArgList &Args) const { - if (runtimeLibType) - return *runtimeLibType; - const Arg* A = Args.getLastArg(options::OPT_rtlib_EQ); StringRef LibName = A ? A->getValue() : CLANG_DEFAULT_RTLIB; // Only use "platform" in tests to override CLANG_DEFAULT_RTLIB! if (LibName == "compiler-rt") - runtimeLibType = ToolChain::RLT_CompilerRT; + return ToolChain::RLT_CompilerRT; else if (LibName == "libgcc") - runtimeLibType = ToolChain::RLT_Libgcc; + return ToolChain::RLT_Libgcc; else if (LibName == "platform") - runtimeLibType = GetDefaultRuntimeLibType(); - else { - if (A) - getDriver().Diag(diag::err_drv_invalid_rtlib_name) - << A->getAsString(Args); + return GetDefaultRuntimeLibType(); - runtimeLibType = GetDefaultRuntimeLibType(); - } + if (A) + getDriver().Diag(diag::err_drv_invalid_rtlib_name) << A->getAsString(Args); - return *runtimeLibType; + return GetDefaultRuntimeLibType(); } ToolChain::UnwindLibType ToolChain::GetUnwindLibType( const ArgList &Args) const { - if (unwindLibType) - return *unwindLibType; - const Arg *A = Args.getLastArg(options::OPT_unwindlib_EQ); StringRef LibName = A ? A->getValue() : CLANG_DEFAULT_UNWINDLIB; if (LibName == "none") - unwindLibType = ToolChain::UNW_None; + return ToolChain::UNW_None; else if (LibName == "platform" || LibName == "") { ToolChain::RuntimeLibType RtLibType = GetRuntimeLibType(Args); if (RtLibType == ToolChain::RLT_CompilerRT) - unwindLibType = ToolChain::UNW_None; + return ToolChain::UNW_None; else if (RtLibType == ToolChain::RLT_Libgcc) - unwindLibType = ToolChain::UNW_Libgcc; + return ToolChain::UNW_Libgcc; } else if (LibName == "libunwind") { if (GetRuntimeLibType(Args) == RLT_Libgcc) getDriver().Diag(diag::err_drv_incompatible_unwindlib); - unwindLibType = ToolChain::UNW_CompilerRT; + return ToolChain::UNW_CompilerRT; } else if (LibName == "libgcc") - unwindLibType = ToolChain::UNW_Libgcc; - else { - if (A) - getDriver().Diag(diag::err_drv_invalid_unwindlib_name) - << A->getAsString(Args); + return ToolChain::UNW_Libgcc; - unwindLibType = GetDefaultUnwindLibType(); - } + if (A) + getDriver().Diag(diag::err_drv_invalid_unwindlib_name) + << A->getAsString(Args); - return *unwindLibType; + return GetDefaultUnwindLibType(); } ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{ - if (cxxStdlibType) - return *cxxStdlibType; - const Arg *A = Args.getLastArg(options::OPT_stdlib_EQ); StringRef LibName = A ? A->getValue() : CLANG_DEFAULT_CXX_STDLIB; // Only use "platform" in tests to override CLANG_DEFAULT_CXX_STDLIB! if (LibName == "libc++") - cxxStdlibType = ToolChain::CST_Libcxx; + return ToolChain::CST_Libcxx; else if (LibName == "libstdc++") - cxxStdlibType = ToolChain::CST_Libstdcxx; + return ToolChain::CST_Libstdcxx; else if (LibName == "platform") - cxxStdlibType = GetDefaultCXXStdlibType(); - else { - if (A) - getDriver().Diag(diag::err_drv_invalid_stdlib_name) - << A->getAsString(Args); + return GetDefaultCXXStdlibType(); - cxxStdlibType = GetDefaultCXXStdlibType(); - } + if (A) + getDriver().Diag(diag::err_drv_invalid_stdlib_name) << A->getAsString(Args); - return *cxxStdlibType; + return GetDefaultCXXStdlibType(); } /// Utility function to add a system include directory to CC1 arguments. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits