mstorsjo created this revision. mstorsjo added reviewers: martell, rnk, compnerd, mati865. Herald added a reviewer: EricWF.
This makes it consistent with libstdc++ and the other default include directories. If these headers are found in both locations and one isn't a symlink to the other, this will cause errors due to libc++ headers having wrapper headers for some standard C headers, wrappers that do #include_next the actual one. If the same libc++ standard C wrapper header exists in more than one include directory before the real system one, the header include guard will stop it from doing another #include_next to pick up the real one, breaking things. As this is a rather uncommon situation, this should be acceptable and toolchain maintainers can adapt accordingly if necessary. Repository: rC Clang https://reviews.llvm.org/D45500 Files: lib/Driver/ToolChains/MinGW.cpp test/Driver/mingw.cpp Index: test/Driver/mingw.cpp =================================================================== --- test/Driver/mingw.cpp +++ test/Driver/mingw.cpp @@ -3,6 +3,10 @@ // CHECK_MINGW_CLANG_TREE: "{{.*}}/Inputs/mingw_clang_tree/mingw32{{/|\\\\}}include" +// RUN: %clang -target i686-windows-gnu -rtlib=platform -stdlib=libc++ -c -### --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_CLANG_TREE_LIBCXX %s +// CHECK_MINGW_CLANG_TREE_LIBCXX: "{{.*}}/Inputs/mingw_clang_tree/mingw32{{/|\\\\}}i686-w64-mingw32{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1" + + // RUN: %clang -target i686-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ -c -### --sysroot=%S/Inputs/mingw_mingw_org_tree/mingw %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_ORG_TREE %s // CHECK_MINGW_ORG_TREE: "{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|\\\\}}lib{{/|\\\\}}gcc{{/|\\\\}}mingw32{{/|\\\\}}4.8.1{{/|\\\\}}include{{/|\\\\}}c++" // CHECK_MINGW_ORG_TREE: "{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|\\\\}}lib{{/|\\\\}}gcc{{/|\\\\}}mingw32{{/|\\\\}}4.8.1{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}mingw32" Index: lib/Driver/ToolChains/MinGW.cpp =================================================================== --- lib/Driver/ToolChains/MinGW.cpp +++ lib/Driver/ToolChains/MinGW.cpp @@ -456,6 +456,10 @@ switch (GetCXXStdlibType(DriverArgs)) { case ToolChain::CST_Libcxx: addSystemInclude(DriverArgs, CC1Args, + Base + Arch + llvm::sys::path::get_separator() + + "include" + llvm::sys::path::get_separator() + + "c++" + llvm::sys::path::get_separator() + "v1"); + addSystemInclude(DriverArgs, CC1Args, Base + "include" + llvm::sys::path::get_separator() + "c++" + llvm::sys::path::get_separator() + "v1"); break;
Index: test/Driver/mingw.cpp =================================================================== --- test/Driver/mingw.cpp +++ test/Driver/mingw.cpp @@ -3,6 +3,10 @@ // CHECK_MINGW_CLANG_TREE: "{{.*}}/Inputs/mingw_clang_tree/mingw32{{/|\\\\}}include" +// RUN: %clang -target i686-windows-gnu -rtlib=platform -stdlib=libc++ -c -### --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_CLANG_TREE_LIBCXX %s +// CHECK_MINGW_CLANG_TREE_LIBCXX: "{{.*}}/Inputs/mingw_clang_tree/mingw32{{/|\\\\}}i686-w64-mingw32{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1" + + // RUN: %clang -target i686-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ -c -### --sysroot=%S/Inputs/mingw_mingw_org_tree/mingw %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_ORG_TREE %s // CHECK_MINGW_ORG_TREE: "{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|\\\\}}lib{{/|\\\\}}gcc{{/|\\\\}}mingw32{{/|\\\\}}4.8.1{{/|\\\\}}include{{/|\\\\}}c++" // CHECK_MINGW_ORG_TREE: "{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|\\\\}}lib{{/|\\\\}}gcc{{/|\\\\}}mingw32{{/|\\\\}}4.8.1{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}mingw32" Index: lib/Driver/ToolChains/MinGW.cpp =================================================================== --- lib/Driver/ToolChains/MinGW.cpp +++ lib/Driver/ToolChains/MinGW.cpp @@ -456,6 +456,10 @@ switch (GetCXXStdlibType(DriverArgs)) { case ToolChain::CST_Libcxx: addSystemInclude(DriverArgs, CC1Args, + Base + Arch + llvm::sys::path::get_separator() + + "include" + llvm::sys::path::get_separator() + + "c++" + llvm::sys::path::get_separator() + "v1"); + addSystemInclude(DriverArgs, CC1Args, Base + "include" + llvm::sys::path::get_separator() + "c++" + llvm::sys::path::get_separator() + "v1"); break;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits