Skip to content

Commit 8638f25

Browse files
authored
Module interfaces: preserve -autolink-force-load (#24265)
Otherwise the overlays won't be force-loaded when you import them. (This feature could possibly be scoped back at this point, but it's not something that should be changed just by using module interfaces!) rdar://problem/50191735 (cherry picked from commit 9b2db03)
1 parent 72d4f3c commit 8638f25

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

include/swift/Option/Options.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ def module_link_name : Separate<["-"], "module-link-name">,
321321
def module_link_name_EQ : Joined<["-"], "module-link-name=">,
322322
Flags<[FrontendOption]>, Alias<module_link_name>;
323323
def autolink_force_load : Flag<["-"], "autolink-force-load">,
324-
Flags<[FrontendOption, HelpHidden]>,
324+
Flags<[FrontendOption, ModuleInterfaceOption, HelpHidden]>,
325325
HelpText<"Force ld to link against this module even if no symbols are used">;
326326

327327
def emit_module : Flag<["-"], "emit-module">,

test/ParseableInterface/option-preservation.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
// RUN: %empty-directory(%t)
22

3-
// RUN: %target-swift-frontend -enable-library-evolution -emit-parseable-module-interface-path %t.swiftinterface -module-name t %s -emit-module -o /dev/null -Onone -enforce-exclusivity=unchecked
3+
// RUN: %target-swift-frontend -enable-library-evolution -emit-parseable-module-interface-path %t.swiftinterface -module-name t %s -emit-module -o /dev/null -Onone -enforce-exclusivity=unchecked -autolink-force-load
44
// RUN: %FileCheck %s < %t.swiftinterface -check-prefix=CHECK-SWIFTINTERFACE
55
//
66
// CHECK-SWIFTINTERFACE: swift-module-flags:
77
// CHECK-SWIFTINTERFACE-SAME: -enable-library-evolution
88
// CHECK-SWIFTINTERFACE-SAME: -Onone
99
// CHECK-SWIFTINTERFACE-SAME: -enforce-exclusivity=unchecked
10+
// CHECK-SWIFTINTERFACE-SAME: -autolink-force-load
1011

1112
// Make sure flags show up when filelists are enabled
1213

13-
// RUN: %target-build-swift %s -driver-filelist-threshold=0 -emit-parseable-module-interface -o %t/foo -module-name foo -module-link-name fooCore -force-single-frontend-invocation -Ounchecked -enforce-exclusivity=unchecked 2>&1
14+
// RUN: %target-build-swift %s -driver-filelist-threshold=0 -emit-parseable-module-interface -o %t/foo -module-name foo -module-link-name fooCore -force-single-frontend-invocation -Ounchecked -enforce-exclusivity=unchecked -autolink-force-load 2>&1
1415
// RUN: %FileCheck %s < %t/foo.swiftinterface --check-prefix CHECK-FILELIST-INTERFACE
1516

1617
// CHECK-FILELIST-INTERFACE: swift-module-flags:
1718
// CHECK-FILELIST-INTERFACE-SAME: -target
19+
// CHECK-FILELIST-INTERFACE-SAME: -autolink-force-load
1820
// CHECK-FILELIST-INTERFACE-SAME: -module-link-name fooCore
1921
// CHECK-FILELIST-INTERFACE-SAME: -enforce-exclusivity=unchecked
2022
// CHECK-FILELIST-INTERFACE-SAME: -Ounchecked

0 commit comments

Comments
 (0)