[PATCH] D149187: [clang] Canonicalize system headers in dependency file when -canonical-prefixes

Arthur Eubanks via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 25 13:27:33 PDT 2023


aeubanks created this revision.
Herald added a project: All.
aeubanks requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.

Clang was writing paths to the dependency file that don't exist when using a sysroot with symlinks, causing everything to get rebuilt every time. This is reproducible on Linux by creating a symlink to '/', using that as the sysroot, and trying to build something with ninja that includes the C++ stdlib (e.g. a typical build of LLVM).

This fixes https://github.com/ninja-build/ninja/issues/1330 and somewhat matches gcc.

gcc canonicalizes system headers in dependency files under a -f[no-]canonical-system-headers, but it makes more sense to look at -canonical-prefixes.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149187

Files:
  clang/include/clang/Driver/Options.td
  clang/include/clang/Frontend/DependencyOutputOptions.h
  clang/include/clang/Frontend/Utils.h
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/DependencyFile.cpp
  clang/test/Driver/canonical-system-headers.c
  clang/test/Preprocessor/Inputs/canonical-system-headers/a.h
  clang/test/Preprocessor/canonical-system-headers.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149187.516885.patch
Type: text/x-patch
Size: 11741 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230425/e58ad1df/attachment-0001.bin>


More information about the cfe-commits mailing list