Skip to content

Commit 3c75762

Browse files
authored
Merge pull request swiftlang#42154 from nkcsgexi/disable-clang-spi-propogate
2 parents f834a51 + 8dd638f commit 3c75762

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

lib/Frontend/CompilerInvocation.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,9 @@ static bool ParseClangImporterArgs(ClangImporterOptions &Opts,
11971197

11981198
Opts.DisableOverlayModules |= Args.hasArg(OPT_emit_imported_modules);
11991199

1200-
Opts.EnableClangSPI = !Args.hasArg(OPT_disable_clang_spi);
1200+
if (Args.hasArg(OPT_disable_clang_spi)) {
1201+
Opts.EnableClangSPI = false;
1202+
}
12011203

12021204
Opts.ExtraArgsOnly |= Args.hasArg(OPT_extra_clang_options_only);
12031205

lib/Frontend/ModuleInterfaceLoader.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,6 +1493,11 @@ InterfaceSubContextDelegateImpl::InterfaceSubContextDelegateImpl(
14931493
}
14941494
}
14951495

1496+
subClangImporterOpts.EnableClangSPI = clangImporterOpts.EnableClangSPI;
1497+
if (!subClangImporterOpts.EnableClangSPI) {
1498+
GenericArgs.push_back("-disable-clang-spi");
1499+
}
1500+
14961501
// Tell the genericSubInvocation to serialize dependency hashes if asked to do
14971502
// so.
14981503
auto &frontendOpts = genericSubInvocation.getFrontendOptions();
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// REQUIRES: OS=macosx
2+
// RUN: %empty-directory(%t/inputs)
3+
// RUN: %target-swift-frontend -typecheck %s -F %S/../ClangImporter/Inputs/frameworks -DFoo -emit-module-interface-path %t/inputs/Foo.swiftinterface -module-name Foo -enable-library-evolution -disable-clang-spi
4+
5+
// RUN: %target-swift-frontend -typecheck %s -F %S/../ClangImporter/Inputs/frameworks -enable-library-evolution -I %t/inputs -disable-clang-spi
6+
7+
// RUN: %target-swift-frontend -typecheck-module-from-interface %t/inputs/Foo.swiftinterface -F %S/../ClangImporter/Inputs/frameworks -disable-clang-spi
8+
9+
10+
#if Foo
11+
12+
import SPIContainer
13+
14+
public func bar(_ c: SPIInterface1) {}
15+
16+
#else
17+
18+
import Foo
19+
20+
#endif

0 commit comments

Comments
 (0)