[all-commits] [llvm/llvm-project] 8f0dd4: [clang] Canonicalize system headers in dependency ...

aeubanks via All-commits all-commits at lists.llvm.org
Mon May 1 10:47:25 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8f0dd4ef3ed2137d1e2554204127434fc46ee190
      https://github.com/llvm/llvm-project/commit/8f0dd4ef3ed2137d1e2554204127434fc46ee190
  Author: Arthur Eubanks <aeubanks at google.com>
  Date:   2023-05-01 (Mon, 01 May 2023)

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

  Log Message:
  -----------
  [clang] Canonicalize system headers in dependency file when -canonical-prefixes

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.

D37954 was a previous attempt at this.

Reviewed By: hans

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




More information about the All-commits mailing list