Skip to content

Commit 8e19cea

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 a1a8dd7 commit 8e19cea

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
@@ -1760,6 +1760,12 @@ function(add_swift_target_library name)
17601760
"-Xfrontend;-disable-implicit-distributed-module-import")
17611761
endif()
17621762

1763+
# Turn off implicit import of _StringProcessing when building libraries
1764+
if(SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING)
1765+
list(APPEND SWIFTLIB_SWIFT_COMPILE_FLAGS
1766+
"-Xfrontend;-disable-implicit-string-processing-module-import")
1767+
endif()
1768+
17631769
if(SWIFTLIB_IS_STDLIB AND SWIFT_STDLIB_ENABLE_PRESPECIALIZATION)
17641770
list(APPEND SWIFTLIB_SWIFT_COMPILE_FLAGS "-Xfrontend;-prespecialize-generic-metadata")
17651771
endif()

0 commit comments

Comments
 (0)