Skip to content

Commit 7803fe2

Browse files
committed
[Embedded] Restrict embedded compilation mode to load serialized binary modules only
1 parent 8e96210 commit 7803fe2

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

lib/Frontend/CompilerInvocation.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4144,6 +4144,7 @@ bool CompilerInvocation::parseArgs(
41444144
IRGenOpts.ReflectionMetadata = ReflectionMetadataMode::None;
41454145
IRGenOpts.EnableReflectionNames = false;
41464146
FrontendOpts.DisableBuildingInterface = true;
4147+
SearchPathOpts.ModuleLoadMode = ModuleLoadingMode::OnlySerialized;
41474148
TypeCheckerOpts.SkipFunctionBodies = FunctionBodySkipping::None;
41484149
SILOpts.SkipFunctionBodies = FunctionBodySkipping::None;
41494150
SILOpts.CMOMode = CrossModuleOptimizationMode::Everything;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: split-file %s %t
3+
4+
// RUN: %target-swift-frontend -emit-module %t/Foo.swift -emit-module-path %t/Foo.swiftmodule/%target-swiftmodule-name -module-name Foo -emit-module-interface-path %t/Foo.swiftmodule/%target-swiftinterface-name -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import -parse-stdlib -enable-library-evolution
5+
6+
// RUN: %target-swift-frontend -scan-dependencies \
7+
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import -parse-stdlib \
8+
// RUN: %t/main.swift -I %t -enable-experimental-feature Embedded -o - | %FileCheck %s --check-prefix=SERIALIZED
9+
10+
// SERIALIZED: "swiftPrebuiltExternal": "Foo"
11+
12+
//--- main.swift
13+
import Foo
14+
15+
//--- Foo.swift
16+
public func foo() {}
17+

0 commit comments

Comments
 (0)