Skip to content

Commit 1c652ef

Browse files
authored
Merge pull request #71901 from artemcm/InterfaceVerifyUseXccFix
[Explicit Module Builds] Explicit interface verification sub-invocations must always inherit `-Xcc` flags from the parent instance.
2 parents ba21a14 + b9d7ead commit 1c652ef

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

lib/Frontend/ModuleInterfaceLoader.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1824,7 +1824,10 @@ InterfaceSubContextDelegateImpl::InterfaceSubContextDelegateImpl(
18241824
clangImporterOpts.getReducedExtraArgsForSwiftModuleDependency();
18251825
genericSubInvocation.getFrontendOptions()
18261826
.DependencyScanningSubInvocation = true;
1827-
} else if (LoaderOpts.strictImplicitModuleContext) {
1827+
} else if (LoaderOpts.strictImplicitModuleContext ||
1828+
// Explicit module Interface verification jobs still spawn a sub-instance
1829+
// and we must ensure this sub-instance gets all of the Xcc flags.
1830+
LoaderOpts.disableImplicitSwiftModule) {
18281831
// If the compiler has been asked to be strict with ensuring downstream
18291832
// dependencies get the parent invocation's context, inherit the extra Clang
18301833
// arguments also. Inherit any clang-specific state of the compilation
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// REQUIRES: objc_interop
2+
// RUN: %empty-directory(%t)
3+
// RUN: %empty-directory(%t/inputs)
4+
// RUN: %target-swift-emit-pcm -module-name SwiftShims %swift-lib-dir/swift/shims/module.modulemap -o %t/inputs/SwiftShims.pcm -Xcc -fobjc-disable-direct-methods-for-testing
5+
// RUN: echo "[{" > %/t/inputs/map.json
6+
// RUN: echo "\"moduleName\": \"Swift\"," >> %/t/inputs/map.json
7+
// RUN: echo "\"modulePath\": \"%/stdlib_module\"," >> %/t/inputs/map.json
8+
// RUN: echo "\"isFramework\": false" >> %/t/inputs/map.json
9+
// RUN: echo "}," >> %/t/inputs/map.json
10+
// RUN: echo "{" >> %/t/inputs/map.json
11+
// RUN: echo "\"moduleName\": \"SwiftOnoneSupport\"," >> %/t/inputs/map.json
12+
// RUN: echo "\"modulePath\": \"%/ononesupport_module\"," >> %/t/inputs/map.json
13+
// RUN: echo "\"isFramework\": false" >> %/t/inputs/map.json
14+
// RUN: echo "}," >> %/t/inputs/map.json
15+
// RUN: echo "{" >> %/t/inputs/map.json
16+
// RUN: echo "\"moduleName\": \"SwiftShims\"," >> %/t/inputs/map.json
17+
// RUN: echo "\"isFramework\": false," >> %/t/inputs/map.json
18+
// RUN: echo "\"clangModuleMapPath\": \"%swift-lib-dir/swift/shims/module.modulemap\"," >> %/t/inputs/map.json
19+
// RUN: echo "\"clangModulePath\": \"%t/inputs/SwiftShims.pcm\"" >> %/t/inputs/map.json
20+
// RUN: echo "}]" >> %/t/inputs/map.json
21+
22+
// RUN: split-file %s %t
23+
// RUN: %target-swift-typecheck-module-from-interface(%t/inputs/Foo.swiftinterface) -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import -disable-implicit-swift-modules -explicit-swift-module-map-file %t/inputs/map.json -explicit-interface-module-build -Xcc -fobjc-disable-direct-methods-for-testing
24+
25+
//--- inputs/Foo.swiftinterface
26+
// swift-interface-format-version: 1.0
27+
// swift-module-flags: -module-name Foo
28+
public func foo() {}

0 commit comments

Comments
 (0)