Skip to content

Commit c1f4bcf

Browse files
committed
Merge branch 'main' into users/kovdan01/ast-bridges-for-autodiff-closure-spec
2 parents f0bf57a + 8748213 commit c1f4bcf

File tree

667 files changed

+17874
-7317
lines changed

Some content is hidden

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

667 files changed

+17874
-7317
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@
230230
/test/Generics/ @hborla @slavapestov
231231
/test/Generics/inverse* @kavon
232232
/test/IDE/ @bnbarham @hamishknight @rintaro
233-
/test/IRGen/ @AnthonyLatsis @rjmccall
233+
/test/IRGen/ @rjmccall
234234
/test/Index/ @bnbarham @hamishknight @rintaro
235235
/test/Interop/ @egorzhdan @Xazax-hun @j-hui @susmonteiro @hnrklssn
236236
/test/Macros/SwiftifyImport @hnrklssn @Xazax-hun

CHANGELOG.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,39 @@
55
66
## Swift (next)
77

8+
* [SE-0491][]:
9+
You can now use a module selector to specify which module Swift should look inside to find a named declaration. A
10+
module selector is written before the name it qualifies and consists of the module name and two colons (`::`):
11+
12+
```swift
13+
// This type conforms to the `View` protocol from `SwiftUI`, even if other
14+
// modules have also declared a type named `View`:
15+
struct MyView: SwiftUI::View { ... }
16+
```
17+
18+
A module selector can also be applied to the name of a member; this is helpful if extensions in other modules have
19+
added an ambiguous overload:
20+
21+
```swift
22+
// Calls the `data(using:)` method added by `Foundation`, even if other
23+
// modules have added identical overloads of `data(using:)`.
24+
let data = "a little bit of text".Foundation::data(using: .utf8)
25+
```
26+
27+
When a module selector is used, Swift skips past any enclosing scopes and starts its search at the top level of the
28+
module; this means that certain declarations, such as local variables and generic parameter types, cannot be found
29+
with a module selector. Constraints in `where` clauses also cannot use a module selector to refer to an associated
30+
type.
31+
32+
Module selectors are primarily intended to be used when working around unavoidable conflicts, such as when two
33+
modules you don't control both use the same name. API designs which force clients to use a module selector are not
34+
recommended; it is usually better to rename a declaration instead. (19481048)
35+
36+
* If you maintain a module built with Library Evolution, you can now configure Swift to use module selectors to improve
37+
the robustness of its module interface file. This is especially helpful if your module declares a type with the same
38+
name as the module itself. To opt in to this behavior, add the `-enable-module-selectors-in-module-interface` flag to
39+
the `OTHER_SWIFT_FLAGS` build setting.
40+
841
* Concurrency-related APIs like `Task` and string-processing-related APIs like `Regex` can now be qualified by the name
942
`Swift`, just like other standard library APIs:
1043

@@ -10925,6 +10958,7 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
1092510958
[SE-0470]: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0470-isolated-conformances.md
1092610959
[SE-0471]: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0371-isolated-synchronous-deinit.md
1092710960
[SE-0472]: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0472-task-start-synchronously-on-caller-context.md
10961+
[SE-0491]: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0491-module-selectors.md
1092810962
[#64927]: <https://github.com/apple/swift/issues/64927>
1092910963
[#42697]: <https://github.com/apple/swift/issues/42697>
1093010964
[#42728]: <https://github.com/apple/swift/issues/42728>

CMakeLists.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,16 +271,16 @@ option(SWIFT_BUILD_STDLIB_CXX_MODULE
271271
"If not building stdlib, controls whether to build the Cxx module"
272272
TRUE)
273273

274-
# The swiftClientRetainRelease library is currently only available for Darwin
274+
# The swiftSwiftDirectRuntime library is currently only available for Darwin
275275
# platforms.
276276
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)
277277
# Off by default everywhere for now.
278-
option(SWIFT_BUILD_CLIENT_RETAIN_RELEASE
279-
"Build the swiftClientRetainRelease library"
278+
option(SWIFT_BUILD_SWIFT_DIRECT_RUNTIME
279+
"Build the swiftSwiftDirectRuntime library"
280280
FALSE)
281281
else()
282-
option(SWIFT_BUILD_CLIENT_RETAIN_RELEASE
283-
"Build the swiftClientRetainRelease library"
282+
option(SWIFT_BUILD_SWIFT_DIRECT_RUNTIME
283+
"Build the swiftSwiftDirectRuntime library"
284284
FALSE)
285285
endif()
286286

@@ -1550,6 +1550,10 @@ else()
15501550
# Some of the things below depend on the threading library
15511551
add_subdirectory(stdlib/public/Threading)
15521552

1553+
if(SWIFT_BUILD_SWIFT_DIRECT_RUNTIME)
1554+
add_subdirectory(stdlib/public/SwiftDirectRuntime)
1555+
endif()
1556+
15531557
if(SWIFT_BUILD_STDLIB_EXTRA_TOOLCHAIN_CONTENT)
15541558
add_subdirectory(stdlib/toolchain)
15551559

Runtimes/Core/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ defaulted_option(SwiftCore_ENABLE_BACKDEPLOYMENT_SUPPORT "Add symbols for runtim
109109
defaulted_option(SwiftCore_ENABLE_STDLIB_TRACING "Enable tracing in the runtime. Assumes the presence of os_log(3) and the os_signpost(3) API.")
110110
defaulted_option(SwiftCore_ENABLE_CONCURRENCY "Enable Concurrency runtime support")
111111
defaulted_option(SwiftCore_ENABLE_REMOTE_MIRROR "Enable RemoteMirror runtime support")
112+
defaulted_option(SwiftCore_ENABLE_DIRECT_RETAIN_RELEASE "Use direct retain release in the runtime/stdlib")
112113
defaulted_set(SwiftCore_CONCURRENCY_GLOBAL_EXECUTOR STRING "Default Concurrency global executor implementation")
113114
option(SwiftCore_ENABLE_COMMANDLINE_SUPPORT "Enable command line argument support" ON)
114115
option(SwiftCore_ENABLE_UNICODE_DATA "Include unicode data in Swift runtimes" ON)
@@ -196,6 +197,11 @@ add_compile_options(
196197
"$<$<AND:$<BOOL:${SwiftCore_ENABLE_LIBRARY_EVOLUTION}>,$<COMPILE_LANGUAGE:Swift>>:-enable-library-evolution>"
197198
"$<$<AND:$<BOOL:${SwiftCore_ENABLE_PRESPECIALIZATION}>,$<COMPILE_LANGUAGE:Swift>>:SHELL:-Xfrontend -prespecialize-generic-metadata>")
198199

200+
if(SwiftCore_ENABLE_DIRECT_RETAIN_RELEASE)
201+
find_package(SwiftSwiftDirectRuntime REQUIRED)
202+
add_compile_options("$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -enable-direct-retain-release>")
203+
endif()
204+
199205
include(ExperimentalFeatures)
200206

201207
include_directories(include)
@@ -206,7 +212,7 @@ add_subdirectory(Demangling)
206212
add_subdirectory(Threading)
207213
add_subdirectory(runtime)
208214
add_subdirectory(stubs)
209-
add_subdirectory(core)
215+
add_subdirectory(Core)
210216
if(SwiftCore_ENABLE_COMMANDLINE_SUPPORT)
211217
add_subdirectory(CommandLineSupport)
212218
endif()

Runtimes/Core/Concurrency/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ target_link_libraries(swift_Concurrency PRIVATE
139139
$<$<PLATFORM_ID:Android>:log>
140140
$<$<PLATFORM_ID:Windows>:Synchronization>
141141
$<$<PLATFORM_ID:Windows>:mincore>
142+
$<$<BOOL:${SwiftSwiftDirectRuntime_FOUND}>:swiftSwiftDirectRuntime>
142143
# Link to the runtime that we are just building.
143144
swiftCore)
144145
set_target_properties(swift_Concurrency PROPERTIES

Runtimes/Core/core/CMakeLists.txt renamed to Runtimes/Core/Core/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ target_link_libraries(swiftCore
337337
swiftStdlibStubs
338338
swiftThreading
339339
$<$<NOT:$<PLATFORM_ID:Darwin>>:swiftrt$<$<PLATFORM_ID:Windows>:T>>
340+
$<$<BOOL:${SwiftSwiftDirectRuntime_FOUND}>:swiftSwiftDirectRuntime>
340341
PUBLIC
341342
swiftShims
342343
INTERFACE

Runtimes/Core/SwiftOnoneSupport/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ target_compile_definitions(swiftSwiftOnoneSupport PRIVATE
2929
target_link_libraries(swiftSwiftOnoneSupport
3030
PRIVATE
3131
swiftShims
32-
swiftCore)
32+
swiftCore
33+
$<$<BOOL:${SwiftSwiftDirectRuntime_FOUND}>:swiftSwiftDirectRuntime>)
3334

3435
install(TARGETS swiftSwiftOnoneSupport
3536
EXPORT SwiftCoreTargets

Runtimes/Core/cmake/interface/SwiftCoreConfig.cmake.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ set(SwiftCore_ENABLE_LIBRARY_EVOLUTION @SwiftCore_ENABLE_LIBRARY_EVOLUTION@)
66
set(SwiftCore_ENABLE_VECTOR_TYPES @SwiftCore_ENABLE_VECTOR_TYPES@)
77

88
set(SwiftCore_ENABLE_BACKDEPLOYMENT_SUPPORT @SwiftCore_ENABLE_BACKDEPLOYMENT_SUPPORT@)
9+
10+
set(SwiftCore_ENABLE_DIRECT_RETAIN_RELEASE @SwiftCore_ENABLE_DIRECT_RETAIN_RELEASE@)

Runtimes/Core/cmake/modules/DefaultSettings.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,15 @@ if(APPLE)
4646
set(SwiftCore_THREADING_PACKAGE_default "DARWIN")
4747
set(SwiftCore_ENABLE_PRESPECIALIZATION_default ON)
4848
set(SwiftCore_CONCURRENCY_GLOBAL_EXECUTOR_default "dispatch")
49+
# TODO we are not ready to enable it here
50+
set(SwiftCore_ENABLE_DIRECT_RETAIN_RELEASE_default OFF)
4951
elseif(CMAKE_SYSTEM_NAME STREQUAL "WASM")
5052
set(SwiftCore_OBJECT_FORMAT_default "elf")
5153
set(SwiftCore_THREADING_PACKAGE_default "NONE")
5254
set(SwiftCore_ENABLE_CONCURRENCY_default NO)
5355
set(SwiftCore_ENABLE_REMOTE_MIRROR_default NO)
5456
set(SwiftCore_CONCURRENCY_GLOBAL_EXECUTOR_default "none")
57+
set(SwiftCore_ENABLE_DIRECT_RETAIN_RELEASE_default OFF)
5558
elseif(LINUX OR ANDROID OR BSD)
5659
set(SwiftCore_OBJECT_FORMAT_default "elf")
5760

@@ -66,6 +69,7 @@ elseif(LINUX OR ANDROID OR BSD)
6669
set(SwiftCore_ENABLE_CONCURRENCY_default NO)
6770
set(SwiftCore_ENABLE_REMOTE_MIRROR_default NO)
6871
set(SwiftCore_CONCURRENCY_GLOBAL_EXECUTOR_default "dispatch")
72+
set(SwiftCore_ENABLE_DIRECT_RETAIN_RELEASE_default OFF)
6973
elseif(WIN32)
7074
set(SwiftCore_OBJECT_FORMAT_default "coff")
7175

@@ -80,6 +84,7 @@ elseif(WIN32)
8084
# errors
8185
set(SwiftCore_ENABLE_PRESPECIALIZATION_default OFF)
8286
set(SwiftCore_CONCURRENCY_GLOBAL_EXECUTOR_default "dispatch")
87+
set(SwiftCore_ENABLE_DIRECT_RETAIN_RELEASE_default OFF)
8388

8489
set(SwiftCore_ENABLE_VECTOR_TYPES_default ON)
8590
set(SwiftCore_ENABLE_FILESYSTEM_SUPPORT_default ON)

Runtimes/Overlay/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ option(SwiftOverlay_ENABLE_LIBRARY_EVOLUTION "Generate ABI resilient runtime lib
5959
${SwiftCore_ENABLE_LIBRARY_EVOLUTION})
6060
option(SwiftOverlay_ENABLE_BACKDEPLOYMENT_SUPPORT "Add symbols for runtime backdeployment"
6161
${SwiftCore_ENABLE_BACKDEPLOYMENT_SUPPORT})
62+
option(${PROJECT_NAME}_ENABLE_DIRECT_RETAIN_RELEASE "Use direct retain release in overlays"
63+
${SwiftCore_ENABLE_DIRECT_RETAIN_RELEASE})
6264

6365
add_compile_definitions(
6466
$<$<BOOL:${SwiftOverlay_ENABLE_BACKDEPLOYMENT_SUPPORT}>:SWIFT_STDLIB_SUPPORT_BACK_DEPLOYMENT>)
@@ -74,6 +76,11 @@ add_compile_options(
7476
"$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_LIBRARY_EVOLUTION}>,$<COMPILE_LANGUAGE:Swift>>:-enable-library-evolution>"
7577
"$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_PRESPECIALIZATION}>,$<COMPILE_LANGUAGE:Swift>>:SHELL:-Xfrontend -prespecialize-generic-metadata>")
7678

79+
if(${PROJECT_NAME}_ENABLE_DIRECT_RETAIN_RELEASE)
80+
find_package(SwiftSwiftDirectRuntime REQUIRED)
81+
add_compile_options("$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -enable-direct-retain-release>")
82+
endif()
83+
7784
include(ExperimentalFeatures)
7885

7986
# LNK4049: symbol 'symbol' defined in 'filename.obj' is imported

0 commit comments

Comments
 (0)