Skip to content

Commit fc791cf

Browse files
committed
Prepare to enable string processing by default.
This is some groundwork to make it possible to flip the `-enable-experimental-string-processing` flag on by default if and when it passes Swift Evolution. This PR itself do **not** change the defaults. - Do not implicitly import _StringProcessing when building a module interface. - Do not implicitly import _StringProcessing when core libraries, same as _Concurrency.
1 parent d1ad4dd commit fc791cf

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/Frontend/Frontend.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,9 @@ bool CompilerInvocation::shouldImportSwiftConcurrency() const {
794794

795795
bool CompilerInvocation::shouldImportSwiftStringProcessing() const {
796796
return getLangOptions().EnableExperimentalStringProcessing &&
797-
!getLangOptions().DisableImplicitStringProcessingModuleImport;
797+
!getLangOptions().DisableImplicitStringProcessingModuleImport &&
798+
getFrontendOptions().InputMode !=
799+
FrontendOptions::ParseInputMode::SwiftModuleInterface;
798800
}
799801

800802
/// Implicitly import the SwiftOnoneSupport module in non-optimized

stdlib/cmake/modules/AddSwiftStdlib.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1766,6 +1766,12 @@ function(add_swift_target_library name)
17661766
"-Xfrontend;-disable-implicit-distributed-module-import")
17671767
endif()
17681768

1769+
# Turn off implicit import of _StringProcessing when building libraries
1770+
if(SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING)
1771+
list(APPEND SWIFTLIB_SWIFT_COMPILE_FLAGS
1772+
"-Xfrontend;-disable-implicit-string-processing-module-import")
1773+
endif()
1774+
17691775
if(SWIFTLIB_IS_STDLIB AND SWIFT_STDLIB_ENABLE_PRESPECIALIZATION)
17701776
list(APPEND SWIFTLIB_SWIFT_COMPILE_FLAGS "-Xfrontend;-prespecialize-generic-metadata")
17711777
endif()

0 commit comments

Comments
 (0)