[PATCH] D88984: Prefer libc++ headers in the -isysroot over the toolchain

Louis Dionne via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 7 10:17:22 PDT 2020


ldionne created this revision.
ldionne added reviewers: arphaman, dexonsmith.
Herald added subscribers: cfe-commits, jkorous.
Herald added a project: clang.
ldionne requested review of this revision.

Currently, Clang looks for libc++ headers alongside the installation
directory of Clang, and it also adds a search path for headers in the
-isysroot. This patch roughly reverses the order so that headers are
searched for in the following order:

1. <isysroot>/usr/include/c++/v1
2. <installdir>/bin/../include/c++/v1

The benefit of doing this is that a user-installed libc++ can be picked
up when providing a custom sysroot, which doesn't work properly right
now. Furthermore, instead of always adding both search paths, we find
the first search path that exists and only add that one. Otherwise,
include_next is broken because there could be two sets of libc++ headers
on the search paths.

rdar://48638125


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88984

Files:
  clang-tools-extra/test/clang-tidy/infrastructure/Inputs/empty-sysroot/.gitkeep
  clang-tools-extra/test/clang-tidy/infrastructure/Inputs/mock-libcxx/bin/clang
  clang-tools-extra/test/clang-tidy/infrastructure/Inputs/mock-libcxx/include/c++/v1/mock_vector
  clang-tools-extra/test/clang-tidy/infrastructure/Inputs/mock-toolchain-root/bin/clang
  clang-tools-extra/test/clang-tidy/infrastructure/Inputs/mock-toolchain-root/include/c++/v1/mock_vector
  clang-tools-extra/test/clang-tidy/infrastructure/clang-tidy-mac-libcxx.cpp
  clang/lib/Driver/ToolChains/Darwin.cpp
  clang/test/Driver/Inputs/basic_darwin_sdk_usr_cxx_v1/usr/include/c++/v1/.keep
  clang/test/Driver/Inputs/basic_darwin_sdk_usr_cxx_v1/usr/lib/.keep
  clang/test/Driver/darwin-header-search-libcxx.cpp
  clang/test/Tooling/Inputs/empty-sysroot/.gitkeep
  clang/test/Tooling/Inputs/mock-libcxx/bin/clang
  clang/test/Tooling/Inputs/mock-libcxx/include/c++/v1/mock_vector
  clang/test/Tooling/Inputs/mock-toolchain-root/bin/clang
  clang/test/Tooling/Inputs/mock-toolchain-root/include/c++/v1/mock_vector
  clang/test/Tooling/clang-check-mac-libcxx-abspath.cpp
  clang/test/Tooling/clang-check-mac-libcxx-fixed-compilation-db.cpp
  clang/test/Tooling/clang-check-mac-libcxx-relpath.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88984.296728.patch
Type: text/x-patch
Size: 21039 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201007/be17fa08/attachment-0001.bin>


More information about the cfe-commits mailing list