[PATCH] D126289: [Clang][Driver] Fix include paths for `--sysroot /` on Linux

Egor Zhdan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 24 04:14:48 PDT 2022


egorzhdan created this revision.
Herald added subscribers: pmatos, asb, jgravelle-google, sbc100, dschuff.
Herald added a project: All.
egorzhdan requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, aheejin.
Herald added a project: clang.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126289

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126289.431640.patch
Type: text/x-patch
Size: 18419 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220524/df48ea30/attachment-0001.bin>


More information about the cfe-commits mailing list