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
17 lines
678 B
C
17 lines
678 B
C
// don't create symlinks on windows
|
|
// UNSUPPORTED: system-windows
|
|
// REQUIRES: shell
|
|
|
|
// RUN: rm -rf %t
|
|
// RUN: mkdir -p %t/foo/
|
|
// RUN: ln -f -s %S/Inputs/canonical-system-headers %t/foo/include
|
|
// RUN: %clang_cc1 -isystem %t/foo/include -sys-header-deps -MT foo.o -dependency-file %t2 %s -fsyntax-only
|
|
// RUN: FileCheck %s --check-prefix=NOCANON --implicit-check-not=a.h < %t2
|
|
// RUN: %clang_cc1 -isystem %t/foo/include -sys-header-deps -MT foo.o -dependency-file %t2 %s -fsyntax-only -canonical-system-headers
|
|
// RUN: FileCheck %s --check-prefix=CANON --implicit-check-not=a.h < %t2
|
|
|
|
// NOCANON: foo/include/a.h
|
|
// CANON: Inputs/canonical-system-headers/a.h
|
|
|
|
#include <a.h>
|