[all-commits] [llvm/llvm-project] e91780: [Clang][Driver] Fix include paths for `--sysroot /...

Egor Zhdan via All-commits all-commits at lists.llvm.org
Fri May 27 08:51:50 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e917801eddbe1b32f1adc81391fd434557391b5e
      https://github.com/llvm/llvm-project/commit/e917801eddbe1b32f1adc81391fd434557391b5e
  Author: Egor Zhdan <e_zhdan at apple.com>
  Date:   2022-05-27 (Fri, 27 May 2022)

  Changed paths:
    M clang/include/clang/Driver/ToolChain.h
    M clang/lib/Driver/ToolChain.cpp
    M clang/lib/Driver/ToolChains/Gnu.cpp
    M clang/lib/Driver/ToolChains/Linux.cpp
    A clang/test/Driver/Inputs/basic_linux_libstdcxx_tree/usr/bin/.keep
    A clang/test/Driver/Inputs/basic_linux_libstdcxx_tree/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8/crtbegin.o
    M clang/test/Driver/linux-header-search.cpp

  Log Message:
  -----------
  [Clang][Driver] Fix include paths for `--sysroot /` on Linux

Currently if `--sysroot /` is passed to the Clang driver, the include paths generated by the Clang driver will start with a double slash: `//usr/include/...`.
 If VFS is used to inject files into the include paths (for example, the Swift compiler does this), VFS will get confused and the injected files won't be visible.

This change makes sure that the include paths start with a single slash.

Fixes #28283.

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




More information about the All-commits mailing list