Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reland [clang] Canonicalize system headers in dependency file when -c…
…anonical-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 ninja-build/ninja#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
- Loading branch information
Showing
8 changed files
with
80 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// RUN: %clang -MD -no-canonical-prefixes -### %s 2>&1 | FileCheck %s --check-prefix=CHECK-NO | ||
// RUN: %clang -MD -canonical-prefixes -### %s 2>&1 | FileCheck %s --check-prefix=CHECK-YES | ||
// RUN: %clang -MD -### %s 2>&1 | FileCheck %s --check-prefix=CHECK-YES | ||
|
||
// CHECK-YES: "-canonical-system-headers" | ||
// CHECK-NO-NOT: "-canonical-system-headers" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// 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> |