[all-commits] [llvm/llvm-project] 578a47: Reland [clang] Canonicalize system headers in depe...

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

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 578a4716f549167165a2ec3bac89c86706136d4e
  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:
  Reland [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.

Fixed use of %T instead of %t in test, causing bots to fail the test on the initial commit.

Reviewed By: hans

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

More information about the All-commits mailing list