Skip to content

Commit 626c32b

Browse files
authored
Merge pull request #67009 from Fushj89/inherit-strict-implicit-module-context-in-sub-swiftinterface
should inherit -strict-implicit-module-context when build sub swiftinterface
2 parents 21a2b78 + 4b7b598 commit 626c32b

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

lib/Frontend/ModuleInterfaceLoader.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,6 +1669,8 @@ InterfaceSubContextDelegateImpl::InterfaceSubContextDelegateImpl(
16691669
// Configure front-end input.
16701670
auto &SubFEOpts = genericSubInvocation.getFrontendOptions();
16711671
SubFEOpts.RequestedAction = LoaderOpts.requestedAction;
1672+
SubFEOpts.StrictImplicitModuleContext =
1673+
LoaderOpts.strictImplicitModuleContext;
16721674
if (!moduleCachePath.empty()) {
16731675
genericSubInvocation.setClangModuleCachePath(moduleCachePath);
16741676
}
@@ -1866,6 +1868,10 @@ InterfaceSubContextDelegateImpl::runInSubCompilerInstance(StringRef moduleName,
18661868
// invocation.
18671869
CompilerInvocation subInvocation = genericSubInvocation;
18681870

1871+
// save `StrictImplicitModuleContext`
1872+
bool StrictImplicitModuleContext =
1873+
subInvocation.getFrontendOptions().StrictImplicitModuleContext;
1874+
18691875
// Save the target triple from the original context.
18701876
llvm::Triple originalTargetTriple(subInvocation.getLangOptions().Target);
18711877

@@ -1950,6 +1956,10 @@ InterfaceSubContextDelegateImpl::runInSubCompilerInstance(StringRef moduleName,
19501956
BuildArgs.push_back(parsedTargetTriple.str());
19511957
}
19521958

1959+
// restore `StrictImplicitModuleContext`
1960+
subInvocation.getFrontendOptions().StrictImplicitModuleContext =
1961+
StrictImplicitModuleContext;
1962+
19531963
CompilerInstance subInstance;
19541964
SubCompilerInstanceInfo info;
19551965
info.Instance = &subInstance;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// swift-interface-format-version: 1.0
22
// swift-module-flags: -enable-library-evolution -module-name ImportsMacroSpecificClangModule
33

4-
import OnlyWithMacro
4+
import SubImportsMacroSpecificClangModule
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// swift-interface-format-version: 1.0
2+
// swift-module-flags: -enable-library-evolution -module-name SubImportsMacroSpecificClangModule
3+
4+
import OnlyWithMacro

test/ModuleInterface/clang-args-transitive-availability.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ import ImportsMacroSpecificClangModule
3030
//CHECK-NEXT: ],
3131
//CHECK-NEXT: "directDependencies": [
3232
//CHECK-NEXT: {
33+
//CHECK-NEXT: "swift": "SubImportsMacroSpecificClangModule"
34+
//CHECK-NEXT: },
35+
//CHECK-NEXT: {
36+
//CHECK-NEXT: "swift": "SwiftOnoneSupport"
37+
38+
//CHECK: "swift": "SubImportsMacroSpecificClangModule"
39+
//CHECK-NEXT: },
40+
//CHECK-NEXT: {
41+
//CHECK-NEXT: "modulePath": "{{.*}}{{/|\\}}SubImportsMacroSpecificClangModule-{{.*}}.swiftmodule",
42+
//CHECK-NEXT: "sourceFiles": [
43+
//CHECK-NEXT: ],
44+
//CHECK-NEXT: "directDependencies": [
45+
//CHECK-NEXT: {
3346
//CHECK-NEXT: "clang": "OnlyWithMacro"
3447

3548
// CHECK: "clang": "OnlyWithMacro"

0 commit comments

Comments
 (0)