[all-commits] [llvm/llvm-project] a3a243: [clang] Don't look into <sysroot> for C++ headers ...

Louis Dionne via All-commits all-commits at lists.llvm.org
Fri Oct 9 09:42:15 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: a3a24316087d0e1b4db0b8fee19cdee8b7968032
      https://github.com/llvm/llvm-project/commit/a3a24316087d0e1b4db0b8fee19cdee8b7968032
  Author: Louis Dionne <ldionne at apple.com>
  Date:   2020-10-09 (Fri, 09 Oct 2020)

  Changed paths:
    M clang/lib/Driver/ToolChains/Darwin.cpp
    A clang/test/Driver/Inputs/basic_darwin_sdk_usr_cxx_v1/usr/include/c++/v1/.keep
    A clang/test/Driver/Inputs/basic_darwin_sdk_usr_cxx_v1/usr/lib/.keep
    M clang/test/Driver/darwin-header-search-libcxx.cpp

  Log Message:
  -----------
  [clang] Don't look into <sysroot> for C++ headers if they are found alongside the toolchain

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 is problematic if headers are found in both the toolchain
and in the sysroot, since #include_next will end up finding the libc++
headers in the sysroot instead of the intended system headers.

This patch changes the logic such that if the toolchain contains libc++
headers, no C++ header paths are added in the sysroot. However, if the
toolchain does *not* contain libc++ headers, the sysroot is searched as
usual.

This should not be a breaking change, since any code that previously
relied on some libc++ headers being found in the sysroot suffered from
the #include_next issue described above, which renders any libc++ header
basically useless.

Differential Revision: https://reviews.llvm.org/D89001




More information about the All-commits mailing list