This revision was automatically updated to reflect the committed changes. Closed by commit rC350714: [Driver] Fix libcxx detection on Darwin with clang run as ./clang (authored by ibiryukov, committed by ).
Changed prior to commit: https://reviews.llvm.org/D56446?vs=180691&id=180822#toc Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D56446/new/ https://reviews.llvm.org/D56446 Files: lib/Driver/ToolChains/Darwin.cpp test/Driver/darwin-stdlib.cpp test/Tooling/Inputs/mock-libcxx/bin/clang Index: test/Driver/darwin-stdlib.cpp =================================================================== --- test/Driver/darwin-stdlib.cpp +++ test/Driver/darwin-stdlib.cpp @@ -14,7 +14,7 @@ // optional absolute include for libc++ from InitHeaderSearch.cpp also fires. // CHECK-LIBCXX: "-stdlib=libc++" -// CHECK-LIBCXX: "-internal-isystem" "{{[^"]*}}{{/|\\\\}}Inputs{{/|\\\\}}darwin_toolchain_tree{{/|\\\\}}bin{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1" +// CHECK-LIBCXX: "-internal-isystem" "{{[^"]*}}{{/|\\\\}}Inputs{{/|\\\\}}darwin_toolchain_tree{{/|\\\\}}bin{{/|\\\\}}..{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1" // CHECK-LIBSTDCXX-NOT: -stdlib=libc++ // CHECK-LIBSTDCXX-NOT: -stdlib=libstdc++ Index: test/Tooling/Inputs/mock-libcxx/bin/clang =================================================================== --- test/Tooling/Inputs/mock-libcxx/bin/clang +++ test/Tooling/Inputs/mock-libcxx/bin/clang @@ -0,0 +1 @@ +This file is a placeholder to keep its parent directory in git. Index: lib/Driver/ToolChains/Darwin.cpp =================================================================== --- lib/Driver/ToolChains/Darwin.cpp +++ lib/Driver/ToolChains/Darwin.cpp @@ -1752,10 +1752,11 @@ break; // On Darwin, libc++ may be installed alongside the compiler in // include/c++/v1. - // Get from 'foo/bin' to 'foo'. - SmallString<128> P = llvm::sys::path::parent_path(InstallDir); - // Get to 'foo/include/c++/v1'. - llvm::sys::path::append(P, "include", "c++", "v1"); + // Get from 'foo/bin' to 'foo/include/c++/v1'. + SmallString<128> P = InstallDir; + // Note that InstallDir can be relative, so we have to '..' and not + // parent_path. + llvm::sys::path::append(P, "..", "include", "c++", "v1"); addSystemInclude(DriverArgs, CC1Args, P); break; }
Index: test/Driver/darwin-stdlib.cpp =================================================================== --- test/Driver/darwin-stdlib.cpp +++ test/Driver/darwin-stdlib.cpp @@ -14,7 +14,7 @@ // optional absolute include for libc++ from InitHeaderSearch.cpp also fires. // CHECK-LIBCXX: "-stdlib=libc++" -// CHECK-LIBCXX: "-internal-isystem" "{{[^"]*}}{{/|\\\\}}Inputs{{/|\\\\}}darwin_toolchain_tree{{/|\\\\}}bin{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1" +// CHECK-LIBCXX: "-internal-isystem" "{{[^"]*}}{{/|\\\\}}Inputs{{/|\\\\}}darwin_toolchain_tree{{/|\\\\}}bin{{/|\\\\}}..{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1" // CHECK-LIBSTDCXX-NOT: -stdlib=libc++ // CHECK-LIBSTDCXX-NOT: -stdlib=libstdc++ Index: test/Tooling/Inputs/mock-libcxx/bin/clang =================================================================== --- test/Tooling/Inputs/mock-libcxx/bin/clang +++ test/Tooling/Inputs/mock-libcxx/bin/clang @@ -0,0 +1 @@ +This file is a placeholder to keep its parent directory in git. Index: lib/Driver/ToolChains/Darwin.cpp =================================================================== --- lib/Driver/ToolChains/Darwin.cpp +++ lib/Driver/ToolChains/Darwin.cpp @@ -1752,10 +1752,11 @@ break; // On Darwin, libc++ may be installed alongside the compiler in // include/c++/v1. - // Get from 'foo/bin' to 'foo'. - SmallString<128> P = llvm::sys::path::parent_path(InstallDir); - // Get to 'foo/include/c++/v1'. - llvm::sys::path::append(P, "include", "c++", "v1"); + // Get from 'foo/bin' to 'foo/include/c++/v1'. + SmallString<128> P = InstallDir; + // Note that InstallDir can be relative, so we have to '..' and not + // parent_path. + llvm::sys::path::append(P, "..", "include", "c++", "v1"); addSystemInclude(DriverArgs, CC1Args, P); break; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits