Skip to content

Commit 22f9853

Browse files
authored
[ParseableInterface] Turn on -enable-parseable-module-interface always (swiftlang#23331)
...and remove the option. This is ~technically~ CLI-breaking because Swift 5 shipped this as a hidden driver option, but it wouldn't have /done/ anything in Swift 5, so I think it's okay to remove. Note that if a parseable interface (.swiftinterface) and a binary interface (.swiftmodule) are both present, the binary one will still be preferred. This just /allows/ parseable interfaces to be used. rdar://problem/36885834
1 parent dbe99d7 commit 22f9853

33 files changed

+70
-97
lines changed

include/swift/Frontend/FrontendOptions.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,6 @@ class FrontendOptions {
220220
/// (if asked to emit SIL).
221221
bool EmitVerboseSIL = false;
222222

223-
/// If set, find and import parseable modules from .swiftinterface files.
224-
bool EnableParseableModuleInterface = false;
225-
226223
/// If set, this module is part of a mixed Objective-C/Swift framework, and
227224
/// the Objective-C half should implicitly be visible to the Swift sources.
228225
bool ImportUnderlyingModule = false;

include/swift/Option/Options.td

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -346,11 +346,6 @@ def emit_parseable_module_interface_path :
346346
Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild,
347347
ArgumentIsPath]>,
348348
MetaVarName<"<path>">, HelpText<"Output parseable interface file to <path>">;
349-
def enable_parseable_module_interface :
350-
Flag<["-"], "enable-parseable-module-interface">,
351-
Flags<[FrontendOption, HelpHidden, NoInteractiveOption,
352-
DoesNotAffectIncrementalBuild]>,
353-
HelpText<"Accept parseable .swiftinterface form of modules">;
354349

355350
def emit_objc_header : Flag<["-"], "emit-objc-header">,
356351
Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>,

lib/Driver/ToolChains.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ static void addCommonFrontendArgs(const ToolChain &TC, const OutputInfo &OI,
193193
inputArgs.AddLastArg(arguments, options::OPT_import_underlying_module);
194194
inputArgs.AddLastArg(arguments, options::OPT_module_cache_path);
195195
inputArgs.AddLastArg(arguments, options::OPT_module_link_name);
196-
inputArgs.AddLastArg(arguments, options::OPT_enable_parseable_module_interface);
197196
inputArgs.AddLastArg(arguments, options::OPT_nostdimport);
198197
inputArgs.AddLastArg(arguments, options::OPT_parse_stdlib);
199198
inputArgs.AddLastArg(arguments, options::OPT_resource_dir);

lib/Frontend/ArgsToFrontendOptionsConverter.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,6 @@ bool ArgsToFrontendOptionsConverter::convert(
167167

168168
Opts.EnableSourceImport |= Args.hasArg(OPT_enable_source_import);
169169
Opts.ImportUnderlyingModule |= Args.hasArg(OPT_import_underlying_module);
170-
Opts.EnableParseableModuleInterface |=
171-
Args.hasArg(OPT_enable_parseable_module_interface);
172170
Opts.EnableSerializationNestedTypeLookupTable &=
173171
!Args.hasArg(OPT_disable_serialization_nested_type_lookup_table);
174172

lib/Frontend/Frontend.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,10 +293,7 @@ bool CompilerInstance::setUpModuleLoaders() {
293293
enableLibraryEvolution,
294294
getDependencyTracker()));
295295
}
296-
auto MLM = ModuleLoadingMode::OnlySerialized;
297-
if (Invocation.getFrontendOptions().EnableParseableModuleInterface) {
298-
MLM = ModuleLoadingMode::PreferSerialized;
299-
}
296+
auto MLM = ModuleLoadingMode::PreferSerialized;
300297
if (auto forceModuleLoadingMode =
301298
llvm::sys::Process::GetEnv("SWIFT_FORCE_MODULE_LOADING")) {
302299
if (*forceModuleLoadingMode == "prefer-parseable")

lib/Frontend/ParseableInterfaceModuleLoader.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ class swift::ParseableInterfaceBuilder {
258258
void configureSubInvocationInputsAndOutputs(StringRef OutPath) {
259259
auto &SubFEOpts = subInvocation.getFrontendOptions();
260260
SubFEOpts.RequestedAction = FrontendOptions::ActionType::EmitModuleOnly;
261-
SubFEOpts.EnableParseableModuleInterface = true;
262261
SubFEOpts.InputsAndOutputs.addPrimaryInputFile(interfacePath);
263262
SupplementaryOutputPaths SOPs;
264263
SOPs.ModuleOutputPath = OutPath.str();
@@ -713,9 +712,6 @@ class ParseableInterfaceModuleLoaderImpl {
713712
if (validationInfo.status != serialization::Status::Valid)
714713
return false;
715714

716-
assert(validationInfo.name == moduleName &&
717-
"we built a module at this path with a different name?");
718-
719715
return dependenciesAreUpToDate(allDeps);
720716
}
721717

test/ParseableInterface/ModuleCache/ObjCAttrWithoutFoundation.swiftinterface

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// swift-module-flags: -module-name ObjCAttrWithoutFoundation -enable-library-evolution -enable-objc-interop
33

44
// RUN: %empty-directory(%t)
5-
// RUN: echo 'import ObjCAttrWithoutFoundation' | %target-swift-frontend -typecheck -enable-parseable-module-interface -module-cache-path %t -I %S -
5+
// RUN: echo 'import ObjCAttrWithoutFoundation' | %target-swift-frontend -typecheck -module-cache-path %t -I %S -
66

77
public class MyClass {
88
public init()

test/ParseableInterface/ModuleCache/SerializedSIL.swiftinterface

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// swift-module-flags: -module-name SerializedSIL -enable-library-evolution
33

44
// RUN: %empty-directory(%t)
5-
// RUN: echo 'import SerializedSIL' | %target-swift-frontend -typecheck -enable-parseable-module-interface -module-cache-path %t -I %S -
5+
// RUN: echo 'import SerializedSIL' | %target-swift-frontend -typecheck -module-cache-path %t -I %S -
66
// RUN: %target-sil-opt -disable-sil-linking %t/SerializedSIL-*.swiftmodule -module-name SerializedSIL > %t/SerializedSIL.sil
77
// RUN: %FileCheck %s < %t/SerializedSIL.sil
88
// RUN: %FileCheck -check-prefix NEGATIVE %s < %t/SerializedSIL.sil

test/ParseableInterface/ModuleCache/WrongName.swiftinterface

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
// swift-module-flags: -module-name DreadPirateRoberts
33

44
// RUN: %empty-directory(%t)
5-
// RUN: echo 'import WrongName' | not %target-swift-frontend -typecheck -enable-parseable-module-interface -module-cache-path %t -I %S - 2>&1 | %FileCheck %s
5+
// RUN: echo 'import WrongName' | not %target-swift-frontend -typecheck -module-cache-path %t -I %S - 2>&1 | %FileCheck %s
66

77
// CHECK: :1:8: error: cannot load module 'DreadPirateRoberts' as 'WrongName'

test/ParseableInterface/ModuleCache/force-module-loading-mode-archs.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// RUN: not env SWIFT_FORCE_MODULE_LOADING=only-parseable %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
1717
// RUN: not env SWIFT_FORCE_MODULE_LOADING=only-serialized %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=NO-SUCH-MODULE %s
1818
// (default)
19-
// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -I %t %s 2>&1 | %FileCheck -check-prefix=NO-SUCH-MODULE %s
19+
// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -I %t %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
2020

2121
// 3. Only module is present.
2222
// RUN: %empty-directory(%t/Lib.swiftmodule)
@@ -53,7 +53,7 @@
5353
// RUN: not env SWIFT_FORCE_MODULE_LOADING=only-parseable %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
5454
// RUN: not env SWIFT_FORCE_MODULE_LOADING=only-serialized %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP %s -I %t 2>&1 | %FileCheck -check-prefix=BAD-MODULE %s
5555
// (default)
56-
// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -I %t %s 2>&1 | %FileCheck -check-prefix=BAD-MODULE %s
56+
// RUN: not %target-swift-frontend -typecheck -parse-stdlib -module-cache-path %t/MCP -I %t %s 2>&1 | %FileCheck -check-prefix=FROM-INTERFACE %s
5757

5858
// 6. Both are present but the module can't be opened.
5959
// RUN: chmod a-r %t/Lib.swiftmodule/%target-swiftmodule-name

0 commit comments

Comments
 (0)