Skip to content

Commit d375c97

Browse files
authored
Merge pull request #59623 from rxwei/cherry-42611
2 parents 71e8d06 + c1862bb commit d375c97

File tree

60 files changed

+201
-117
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+201
-117
lines changed

SwiftCompilerSources/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ function(add_swift_compiler_modules_library name)
7676
"-Xfrontend" "-validate-tbd-against-ir=none"
7777
"-Xfrontend" "-enable-cxx-interop"
7878
"-Xcc" "-UIBOutlet" "-Xcc" "-UIBAction" "-Xcc" "-UIBInspectable")
79+
if (NOT BOOTSTRAPPING_MODE STREQUAL "HOSTTOOLS")
80+
list(APPEND swift_compile_options "-Xfrontend" "-disable-implicit-string-processing-module-import")
81+
endif()
7982

8083
if(CMAKE_BUILD_TYPE STREQUAL Debug)
8184
list(APPEND swift_compile_options "-g")

lib/Frontend/CompilerInvocation.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,8 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
515515
// forward slash regex `/.../`.
516516
if (!Opts.EnableExperimentalStringProcessing)
517517
Opts.EnableBareSlashRegexLiterals = false;
518+
} else {
519+
Opts.EnableExperimentalStringProcessing = true;
518520
}
519521

520522
Opts.DisableAvailabilityChecking |=

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()

test/Concurrency/Backdeploy/weak_linking.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend %s -target x86_64-apple-macosx12.0 -module-name main -emit-ir -o %t/new.ir
2+
// RUN: %target-swift-frontend %s -target %target-cpu-apple-macosx12.0 -module-name main -emit-ir -o %t/new.ir
33
// RUN: %FileCheck %s --check-prefix=NEW < %t/new.ir
4-
// RUN: %target-swift-frontend %s -target x86_64-apple-macosx10.15 -module-name main -emit-ir -o %t/old.ir -disable-availability-checking
4+
// RUN: %target-swift-frontend %s -target %target-cpu-apple-macosx10.15 -module-name main -emit-ir -o %t/old.ir -disable-availability-checking
55
// RUN: %FileCheck %s --check-prefix=OLD < %t/old.ir
6-
// RUN: %target-swift-frontend %s -target x86_64-apple-macosx10.15 -O -module-name main -emit-ir -o %t/optimized.ir -disable-availability-checking
6+
// RUN: %target-swift-frontend %s -target %target-cpu-apple-macosx10.15 -O -module-name main -emit-ir -o %t/optimized.ir -disable-availability-checking
77
// RUN: %FileCheck %s --check-prefix=OPTIMIZED < %t/optimized.ir
88

99

test/Frontend/module-alias-explicit-build.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
// RUN: echo "\"moduleName\": \"_Concurrency\"," >> %/t/inputs/map.json
3434
// RUN: echo "\"modulePath\": \"%/concurrency_module\"," >> %/t/inputs/map.json
3535
// RUN: echo "\"isFramework\": false" >> %/t/inputs/map.json
36+
// RUN: echo "}," >> %/t/inputs/map.json
37+
// RUN: echo "{" >> %/t/inputs/map.json
38+
// RUN: echo "\"moduleName\": \"_StringProcessing\"," >> %/t/inputs/map.json
39+
// RUN: echo "\"modulePath\": \"%/string_processing_module\"," >> %/t/inputs/map.json
40+
// RUN: echo "\"isFramework\": false" >> %/t/inputs/map.json
3641
// RUN: echo "}]" >> %/t/inputs/map.json
3742

3843
/// Create a module Foo that imports Cat with -module-alias Cat=Bar with an explicit module loader

test/IDE/print_module_comments.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %empty-directory(%t)
22
//
33
// Build swift modules this test depends on.
4-
// RUN: %target-swift-frontend -disable-implicit-concurrency-module-import -emit-module %S/Inputs/foo_swift_module.swift -emit-module-path %t/foo_swift_module.swiftmodule -emit-module-doc-path %t/foo_swift_module.swiftdoc
4+
// RUN: %target-swift-frontend -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import -emit-module %S/Inputs/foo_swift_module.swift -emit-module-path %t/foo_swift_module.swiftmodule -emit-module-doc-path %t/foo_swift_module.swiftdoc
55
//
66
// RUN: %target-swift-ide-test -print-module -source-filename %s -I %t -module-to-print=foo_swift_module > %t.printed.txt
77
// RUN: diff %t.printed.txt %S/Inputs/foo_swift_module.printed.comments.txt

test/IRGen/ELF-remove-autolink-section.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %swiftc_driver -emit-ir %s -o - -Xfrontend -disable-implicit-concurrency-module-import | %FileCheck %s -check-prefix ELF
1+
// RUN: %swiftc_driver -emit-ir %s -o - -Xfrontend -disable-implicit-concurrency-module-import -Xfrontend -disable-implicit-string-processing-module-import | %FileCheck %s -check-prefix ELF
22

33
// Check that the swift auto link section is available in the object file.
44
// RUN: %swiftc_driver -c %s -o %t -Xfrontend -disable-implicit-concurrency-module-import

test/IRGen/swift_async_extended_frame_info.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// RUN: %target-swift-frontend -disable-availability-checking -swift-async-frame-pointer=always -target x86_64-apple-macosx12 %s -S | %FileCheck -check-prefix=ALWAYS %s
99

1010
// REQUIRES: OS=macosx
11+
// REQUIRES: CPU=x86_64
1112

1213
public func someAsyncFunction() async {
1314
}

test/Index/Store/cross-import-overlay.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// RUN: cp -r %S/../Inputs/CrossImport %t/CrossImport
44
// RUN: %{python} %S/../../CrossImport/Inputs/rewrite-module-triples.py %t/CrossImport %module-target-triple
55

6-
// RUN: %target-swift-frontend -disable-implicit-concurrency-module-import -c -index-store-path %t/idx -module-cache-path %t/mcp -index-system-modules -index-ignore-stdlib -enable-cross-import-overlays %s -Fsystem %t/CrossImport -o %t/file1.o -module-name cross_import_overlay
6+
// RUN: %target-swift-frontend -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import -c -index-store-path %t/idx -module-cache-path %t/mcp -index-system-modules -index-ignore-stdlib -enable-cross-import-overlays %s -Fsystem %t/CrossImport -o %t/file1.o -module-name cross_import_overlay
77
// RUN: c-index-test core -print-unit %t/idx > %t/units
88

99
import A

0 commit comments

Comments
 (0)