Skip to content

Commit 3c5ff99

Browse files
committed
[clang][cas] Prefix map -fdepfile-entry
For rdar://106307646
1 parent 19bb8b1 commit 3c5ff99

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

clang/lib/Tooling/DependencyScanning/ScanAndUpdateArgs.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,14 @@ void DepscanPrefixMapping::remapInvocationPaths(CompilerInvocation &Invocation,
177177
Mapper.mapInPlace(CodeGenOpts.ProfileInstrumentUsePath);
178178
Mapper.mapInPlace(CodeGenOpts.SampleProfileFile);
179179
Mapper.mapInPlace(CodeGenOpts.ProfileRemappingFile);
180+
181+
// Dependency output options.
182+
// Note: these are not in the cache key, but they are in the module context
183+
// hash, which indirectly impacts the cache key when importing a module.
184+
// In the future we may change how -fmodule-file-cache-key works when
185+
// remapping to avoid needing this.
186+
for (auto &ExtraDep : Invocation.getDependencyOutputOpts().ExtraDeps)
187+
Mapper.mapInPlace(ExtraDep.first);
180188
}
181189

182190
void DepscanPrefixMapping::configurePrefixMapper(const CompilerInvocation &CI,

clang/test/CAS/depscan-prefix-map.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
// RUN: -fdepscan-prefix-map=%{objroot}=/^objroot \
1717
// RUN: -fdepscan-prefix-map=%S/Inputs/toolchain_dir=/^toolchain \
1818
// RUN: -fdepscan-prefix-map=%S/Inputs/SDK=/^sdk \
19+
// RUN: -fdepfile-entry=%t.d/extra \
1920
// RUN: | FileCheck %s -DPREFIX=%t.d
2021
// RUN: %clang -cc1depscan -dump-depscan-tree=%t.root -fdepscan=inline \
2122
// RUN: -cc1-args -triple x86_64-apple-macos11.0 -x c %s -o %t.d/out.o \
@@ -29,6 +30,7 @@
2930
// RUN: -fdepscan-prefix-map=%{objroot}=/^objroot \
3031
// RUN: -fdepscan-prefix-map=%S/Inputs/toolchain_dir=/^toolchain \
3132
// RUN: -fdepscan-prefix-map=%S/Inputs/SDK=/^sdk \
33+
// RUN: -fdepfile-entry=%t.d/extra \
3234
// RUN: | FileCheck %s -DPREFIX=%t.d
3335
// RUN: %clang -cc1depscand -execute %{clang-daemon-dir}/%basename_t \
3436
// RUN: -cas-args -fcas-path %t.d/cas -- \
@@ -45,12 +47,14 @@
4547
// RUN: -fdepscan-prefix-map=%{objroot}=/^objroot \
4648
// RUN: -fdepscan-prefix-map=%S/Inputs/toolchain_dir=/^toolchain \
4749
// RUN: -fdepscan-prefix-map=%S/Inputs/SDK=/^sdk \
50+
// RUN: -fdepfile-entry=%t.d/extra \
4851
// RUN: | FileCheck %s -DPREFIX=%t.d
4952
//
5053
// CHECK: "-fcas-path" "[[PREFIX]]/cas"
5154
// CHECK-SAME: "-working-directory" "/^testdir"
5255
// CHECK-SAME: "-x" "c" "/^source/depscan-prefix-map.c"
5356
// CHECK-SAME: "-isysroot" "/^sdk"
57+
// CHECK-SAME: "-fdepfile-entry=/^testdir/extra"
5458

5559
// RUN: llvm-cas --cas %t.d/cas --ls-tree-recursive @%t.root \
5660
// RUN: | FileCheck %s -check-prefix=CHECK-ROOT

0 commit comments

Comments
 (0)