Skip to content

Commit 6cbe902

Browse files
[ExplicitModule] Don't pass PCM output path in -Xcc option
There is no need to pass output path of the PCM compilation twice, once as swift `-o` flag and other time as `-Xcc -o` flag to clang importer. This can also cause swift caching to miss when output path is different because `-Xcc` options are not modeled in caching model to understand `-o` output path doesn't affect compilation output content. rdar://128650954 (cherry picked from commit c1c0257)
1 parent 7e434bc commit 6cbe902

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/ClangImporter/ClangModuleDependencyScanner.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ ModuleDependencyVector ClangImporter::bridgeClangModuleDependencies(
239239
// invocation, not swift invocation.
240240
depsInvocation.getFrontendOpts().ModuleCacheKeys.clear();
241241
depsInvocation.getFrontendOpts().PathPrefixMappings.clear();
242+
depsInvocation.getFrontendOpts().OutputFile.clear();
242243

243244
// FIXME: workaround for rdar://105684525: find the -ivfsoverlay option
244245
// from clang scanner and pass to swift.
@@ -351,7 +352,7 @@ void ClangImporter::recordBridgingHeaderOptions(
351352
clang::frontend::ActionKind::GeneratePCH;
352353
depsInvocation.getFrontendOpts().ModuleCacheKeys.clear();
353354
depsInvocation.getFrontendOpts().PathPrefixMappings.clear();
354-
depsInvocation.getFrontendOpts().OutputFile = "";
355+
depsInvocation.getFrontendOpts().OutputFile.clear();
355356

356357
llvm::BumpPtrAllocator allocator;
357358
llvm::StringSaver saver(allocator);

test/CAS/module_deps_include_tree.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json clang:F clangIncludeTree > %t/F_tree.casid
3333
// RUN: clang-cas-test --cas %t/cas --print-include-tree @%t/F_tree.casid | %FileCheck %s -check-prefix INCLUDE_TREE_F
3434

35+
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json clang:F commandLine > %t/F.cmd
36+
// RUN: %FileCheck %s -check-prefix F_CMD -input-file=%t/F.cmd
37+
// F_CMD: "-Xcc"
38+
// F_CMD-NOT: "-o"
39+
3540
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json deps commandLine > %t/deps.cmd
3641
// RUN: %FileCheck %s -check-prefix MAIN_CMD -input-file=%t/deps.cmd
3742

0 commit comments

Comments
 (0)