File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -546,15 +546,17 @@ bool CompilerInstance::setUpModuleLoaders() {
546
546
// If implicit modules are disabled, we need to install an explicit module
547
547
// loader.
548
548
bool ExplicitModuleBuild = Invocation.getFrontendOptions ().DisableImplicitModules ;
549
- if (ExplicitModuleBuild) {
549
+ if (ExplicitModuleBuild || !Invocation. getSearchPathOptions (). ExplicitSwiftModuleMap . empty () ) {
550
550
auto ESML = ExplicitSwiftModuleLoader::create (
551
551
*Context,
552
552
getDependencyTracker (), MLM,
553
553
Invocation.getSearchPathOptions ().ExplicitSwiftModuleMap ,
554
554
IgnoreSourceInfoFile);
555
555
this ->DefaultSerializedLoader = ESML.get ();
556
556
Context->addModuleLoader (std::move (ESML));
557
- } else {
557
+ }
558
+
559
+ if (!ExplicitModuleBuild) {
558
560
if (MLM != ModuleLoadingMode::OnlySerialized) {
559
561
// We only need ModuleInterfaceLoader for implicit modules.
560
562
auto PIML = ModuleInterfaceLoader::create (
Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: mkdir -p %t/clang-module-cache
3
+ // RUN: mkdir -p %t/inputs
4
+ // RUN: mkdir -p %t/barinputs
5
+ // RUN: echo "public func foo() {}" >> %t/foo.swift
6
+ // RUN: %target-swift-frontend -emit-module -emit-module-path %t/inputs/Foo.swiftmodule -emit-module-doc-path %t/inputs/Foo.swiftdoc -emit-module-source-info -emit-module-source-info-path %t/inputs/Foo.swiftsourceinfo -module-cache-path %t.module-cache %t/foo.swift -module-name Foo
7
+ // RUN: echo "public func bar() {}" >> %t/bar.swift
8
+ // RUN: %target-swift-frontend -emit-module -emit-module-path %t/barinputs/Bar.swiftmodule -emit-module-doc-path %t/barinputs/Bar.swiftdoc -emit-module-source-info -emit-module-source-info-path %t/barinputs/Bar.swiftsourceinfo -module-cache-path %t.module-cache %t/bar.swift -module-name Bar
9
+
10
+ // RUN: echo "[{" > %/t/inputs/map.json
11
+ // RUN: echo "\"moduleName\": \"Foo\"," >> %/t/inputs/map.json
12
+ // RUN: echo "\"modulePath\": \"%/t/inputs/Foo.swiftmodule\"," >> %/t/inputs/map.json
13
+ // RUN: echo "\"docPath\": \"%/t/inputs/Foo.swiftdoc\"," >> %/t/inputs/map.json
14
+ // RUN: echo "\"sourceInfoPath\": \"%/t/inputs/Foo.swiftsourceinfo\"," >> %/t/inputs/map.json
15
+ // RUN: echo "\"isFramework\": false" >> %/t/inputs/map.json
16
+ // RUN: echo "}]" >> %/t/inputs/map.json
17
+
18
+ // RUN: not %target-swift-frontend -typecheck %s -explicit-swift-module-map-file %t/inputs/map.json -disable-implicit-swift-modules
19
+ // RUN: %target-swift-frontend -typecheck %s -explicit-swift-module-map-file %t/inputs/map.json -I %t/barinputs
20
+ import Foo
21
+ import Bar
You can’t perform that action at this time.
0 commit comments