From 22f194909ae24aed817976fb54b759550e90db36 Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Fri, 11 Jun 2021 00:43:52 -0700 Subject: [PATCH] Revert "[Driver] Support libc++ in MSVC" This reverts commit 9625d61eb66c12388875e081b63ebed7e42c6bbb since libc++ currently has issues with disabled exceptions which breaks the runtimes build. --- clang/include/clang/Driver/Options.td | 6 ++-- clang/lib/Driver/ToolChains/MSVC.cpp | 36 +------------------ .../Inputs/msvc_libcxx_tree/usr/bin/.keep | 0 .../msvc_libcxx_tree/usr/include/c++/v1/.keep | 0 .../x86_64-pc-windows-msvc/c++/v1/.keep | 0 .../Inputs/msvc_libcxx_tree/usr/lib/.keep | 0 .../usr/lib/x86_64-pc-windows-msvc/.keep | 0 clang/test/Driver/msvc-libcxx.cpp | 7 ---- 8 files changed, 4 insertions(+), 45 deletions(-) delete mode 100644 clang/test/Driver/Inputs/msvc_libcxx_tree/usr/bin/.keep delete mode 100644 clang/test/Driver/Inputs/msvc_libcxx_tree/usr/include/c++/v1/.keep delete mode 100644 clang/test/Driver/Inputs/msvc_libcxx_tree/usr/include/x86_64-pc-windows-msvc/c++/v1/.keep delete mode 100644 clang/test/Driver/Inputs/msvc_libcxx_tree/usr/lib/.keep delete mode 100644 clang/test/Driver/Inputs/msvc_libcxx_tree/usr/lib/x86_64-pc-windows-msvc/.keep delete mode 100644 clang/test/Driver/msvc-libcxx.cpp diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index d13b9fe0b4e9..6f3169644396 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -3641,12 +3641,12 @@ def noprofilelib : Flag<["-"], "noprofilelib">; def noseglinkedit : Flag<["-"], "noseglinkedit">; def nostartfiles : Flag<["-"], "nostartfiles">, Group; def nostdinc : Flag<["-"], "nostdinc">, Flags<[CoreOption]>; -def nostdlibinc : Flag<["-"], "nostdlibinc">, Flags<[CoreOption]>; -def nostdincxx : Flag<["-"], "nostdinc++">, Flags<[CC1Option, CoreOption]>, +def nostdlibinc : Flag<["-"], "nostdlibinc">; +def nostdincxx : Flag<["-"], "nostdinc++">, Flags<[CC1Option]>, HelpText<"Disable standard #include directories for the C++ standard library">, MarshallingInfoNegativeFlag>; def nostdlib : Flag<["-"], "nostdlib">, Group; -def nostdlibxx : Flag<["-"], "nostdlib++">, Group; +def nostdlibxx : Flag<["-"], "nostdlib++">; def object : Flag<["-"], "object">; def o : JoinedOrSeparate<["-"], "o">, Flags<[NoXarchOption, RenderAsInput, CC1Option, CC1AsOption, FC1Option, FlangOption]>, diff --git a/clang/lib/Driver/ToolChains/MSVC.cpp b/clang/lib/Driver/ToolChains/MSVC.cpp index ea79c0ec9eb5..bb17f73e1488 100644 --- a/clang/lib/Driver/ToolChains/MSVC.cpp +++ b/clang/lib/Driver/ToolChains/MSVC.cpp @@ -435,11 +435,6 @@ void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA, if (!C.getDriver().IsCLMode() && Args.hasArg(options::OPT_L)) for (const auto &LibPath : Args.getAllArgValues(options::OPT_L)) CmdArgs.push_back(Args.MakeArgString("-libpath:" + LibPath)); - // Add library directories for standard library shipped with the toolchain. - for (const auto &LibPath : TC.getFilePaths()) { - if (TC.getVFS().exists(LibPath)) - CmdArgs.push_back(Args.MakeArgString("-libpath:" + LibPath)); - } CmdArgs.push_back("-nologo"); @@ -1328,36 +1323,7 @@ void MSVCToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs, void MSVCToolChain::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, ArgStringList &CC1Args) const { - if (DriverArgs.hasArg(options::OPT_nostdlibinc) || - DriverArgs.hasArg(options::OPT_nostdincxx)) - return; - - switch (GetCXXStdlibType(DriverArgs)) { - case ToolChain::CST_Libcxx: { - SmallString<128> P(getDriver().Dir); - llvm::sys::path::append(P, "..", "include"); - - std::string Version = detectLibcxxVersion(P); - if (Version.empty()) - return; - - // First add the per-target include path if it exists. - SmallString<128> TargetDir(P); - llvm::sys::path::append(TargetDir, getTripleString(), "c++", Version); - if (getVFS().exists(TargetDir)) - addSystemInclude(DriverArgs, CC1Args, TargetDir); - - // Second add the generic one. - SmallString<128> Dir(P); - llvm::sys::path::append(Dir, "c++", Version); - addSystemInclude(DriverArgs, CC1Args, Dir); - break; - } - - default: - // TODO: Shall we report an error for other C++ standard libraries? - break; - } + // FIXME: There should probably be logic here to find libc++ on Windows. } VersionTuple MSVCToolChain::computeMSVCVersion(const Driver *D, diff --git a/clang/test/Driver/Inputs/msvc_libcxx_tree/usr/bin/.keep b/clang/test/Driver/Inputs/msvc_libcxx_tree/usr/bin/.keep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/msvc_libcxx_tree/usr/include/c++/v1/.keep b/clang/test/Driver/Inputs/msvc_libcxx_tree/usr/include/c++/v1/.keep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/msvc_libcxx_tree/usr/include/x86_64-pc-windows-msvc/c++/v1/.keep b/clang/test/Driver/Inputs/msvc_libcxx_tree/usr/include/x86_64-pc-windows-msvc/c++/v1/.keep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/msvc_libcxx_tree/usr/lib/.keep b/clang/test/Driver/Inputs/msvc_libcxx_tree/usr/lib/.keep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/Inputs/msvc_libcxx_tree/usr/lib/x86_64-pc-windows-msvc/.keep b/clang/test/Driver/Inputs/msvc_libcxx_tree/usr/lib/x86_64-pc-windows-msvc/.keep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/clang/test/Driver/msvc-libcxx.cpp b/clang/test/Driver/msvc-libcxx.cpp deleted file mode 100644 index c209ec9aca24..000000000000 --- a/clang/test/Driver/msvc-libcxx.cpp +++ /dev/null @@ -1,7 +0,0 @@ -// RUN: %clangxx -### %s 2>&1 -stdlib=libc++ -fuse-ld=lld \ -// RUN: --target=x86_64-pc-windows-msvc \ -// RUN: -ccc-install-dir %S/Inputs/msvc_libcxx_tree/usr/bin \ -// RUN: | FileCheck %s -check-prefix MSVC-LIBCXX -// MSVC-LIBCXX: "-internal-isystem" "{{.*[/\\]}}include{{/|\\\\}}x86_64-pc-windows-msvc{{/|\\\\}}c++{{/|\\\\}}v1" -// MSVC-LIBCXX: "-internal-isystem" "{{.*[/\\]}}include{{/|\\\\}}c++{{/|\\\\}}v1" -// MSVC-LIBCXX: "-libpath:{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-pc-windows-msvc"