Skip to content

Commit f66e7a5

Browse files
authored
[Dependency Scanning] Ignore -file-compilation-dir during Swift caching build. (#79750)
#79270 taught the dependency scanner to ignore `-file-compilation-dir` when caching is _not_ in effect but did not make the corresponding change when caching is in effect. This PR teaches the scanner to ignore `-file-compliation-dir` when caching is in effect. rdar://146025100
1 parent 3271c19 commit f66e7a5

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4227,6 +4227,10 @@ ClangImporter::getSwiftExplicitModuleDirectCC1Args() const {
42274227
PPOpts.MacroIncludes.clear();
42284228
PPOpts.Includes.clear();
42294229

4230+
// CodeGenOptions.
4231+
auto &CGOpts = instance.getCodeGenOpts();
4232+
CGOpts.DebugCompilationDir.clear();
4233+
42304234
if (Impl.SwiftContext.ClangImporterOpts.UseClangIncludeTree) {
42314235
// FileSystemOptions.
42324236
auto &FSOpts = instance.getFileSystemOpts();

test/CAS/Xcc_args.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
66
// RUN: %t/test.swift -o %t/deps.json -swift-version 5 -cache-compile-job -cas-path %t/cas -Xcc -D_VERSION=1 \
77
// RUN: -Xcc -fmodule-map-file=%t/include/module.modulemap -Xcc -ivfsoverlay -Xcc %t/empty.yaml \
8-
// RUN: -Xcc -I%t/empty.hmap -module-load-mode prefer-serialized
8+
// RUN: -Xcc -I%t/empty.hmap -module-load-mode prefer-serialized \
9+
// RUN: -file-compilation-dir %t
910

1011
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:SwiftShims > %t/shims.cmd
1112
// RUN: %swift_frontend_plain @%t/shims.cmd
@@ -20,6 +21,7 @@
2021
// RUN: %FileCheck %s --input-file=%t/MyApp.cmd
2122

2223
// CHECK: "-direct-clang-cc1-module-build"
24+
// CHECK-NOT: "-fdebug-compilation-dir={{.*}}"
2325
// CHECK: "_VERSION=1"
2426
// CHECK-NOT: hmap.json
2527
// CHECK-NOT: -ivfsoverlay

0 commit comments

Comments
 (0)