Skip to content

Commit 0556ae6

Browse files
authored
Merge pull request #3996 from swiftwasm/main
2 parents 29bc6a5 + cfce85b commit 0556ae6

File tree

290 files changed

+104792
-27832
lines changed

Some content is hidden

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

290 files changed

+104792
-27832
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -560,16 +560,24 @@ function(add_swift_host_library name)
560560
561561
if(NOT ${CMAKE_C_COMPILER_ID} STREQUAL MSVC)
562562
swift_windows_get_sdk_vfs_overlay(ASHL_VFS_OVERLAY)
563-
target_compile_options(${name} PRIVATE
564-
$<$<COMPILE_LANGUAGE:C,CXX,OBJC,OBJCXX>:"SHELL:-Xclang -ivfsoverlay -Xclang ${ASHL_VFS_OVERLAY}">)
565-
566-
# MSVC doesn't support -Xclang. We don't need to manually specify
567-
# the dependent libraries as `cl` does so.
568-
target_compile_options(${name} PRIVATE
569-
$<$<COMPILE_LANGUAGE:C,CXX,OBJC,OBJCXX>:"SHELL:-Xclang --dependent-lib=oldnames">
570-
# TODO(compnerd) handle /MT, /MTd
571-
$<$<COMPILE_LANGUAGE:C,CXX,OBJC,OBJCXX>:"SHELL:-Xclang --dependent-lib=msvcrt$<$<CONFIG:Debug>:d>">
572-
)
563+
# Both clang and clang-cl on Windows set CMAKE_C_SIMULATE_ID to MSVC.
564+
# We are using CMAKE_C_COMPILER_FRONTEND_VARIANT to detect the correct
565+
# way to pass -Xclang arguments.
566+
if ("${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC")
567+
target_compile_options(${name} PRIVATE
568+
$<$<COMPILE_LANGUAGE:C,CXX>:SHELL:/clang:-Xclang /clang:-ivfsoverlay /clang:-Xclang /clang:${ASHL_VFS_OVERLAY}>)
569+
else()
570+
target_compile_options(${name} PRIVATE
571+
$<$<COMPILE_LANGUAGE:C,CXX,OBJC,OBJCXX>:"SHELL:-Xclang -ivfsoverlay -Xclang ${ASHL_VFS_OVERLAY}">)
572+
573+
# MSVC doesn't support -Xclang. We don't need to manually specify
574+
# the dependent libraries as `cl`/`clang-cl` does so.
575+
target_compile_options(${name} PRIVATE
576+
$<$<COMPILE_LANGUAGE:C,CXX,OBJC,OBJCXX>:"SHELL:-Xclang --dependent-lib=oldnames">
577+
# TODO(compnerd) handle /MT, /MTd
578+
$<$<COMPILE_LANGUAGE:C,CXX,OBJC,OBJCXX>:"SHELL:-Xclang --dependent-lib=msvcrt$<$<CONFIG:Debug>:d>">
579+
)
580+
endif()
573581
endif()
574582
575583
set_target_properties(${name} PROPERTIES
@@ -980,9 +988,12 @@ function(add_swift_host_tool executable)
980988
target_include_directories(${executable} SYSTEM PRIVATE
981989
${${SWIFT_HOST_VARIANT_ARCH}_INCLUDE})
982990
983-
if(NOT ${CMAKE_C_COMPILER_ID} STREQUAL MSVC)
991+
# On Windows both clang-cl and clang simulate MSVC.
992+
# We are using CMAKE_C_COMPILER_FRONTEND_VARIANT to distinguish
993+
# clang from clang-cl.
994+
if(NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC" AND NOT "${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC")
984995
# MSVC doesn't support -Xclang. We don't need to manually specify
985-
# the dependent libraries as `cl` does so.
996+
# the dependent libraries as `cl`/`clang-cl` does so.
986997
target_compile_options(${executable} PRIVATE
987998
$<$<COMPILE_LANGUAGE:C,CXX,OBJC,OBJCXX>:"SHELL:-Xclang --dependent-lib=oldnames">
988999
# TODO(compnerd) handle /MT, /MTd

cmake/modules/SwiftWindowsSupport.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,17 @@ macro(swift_swap_compiler_if_needed target)
9292
if("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC")
9393
set(CMAKE_C_COMPILER ${CLANG_LOCATION}/clang-cl${CMAKE_EXECUTABLE_SUFFIX})
9494
set(CMAKE_CXX_COMPILER ${CLANG_LOCATION}/clang-cl${CMAKE_EXECUTABLE_SUFFIX})
95+
set(CMAKE_C_COMPILER_ID Clang)
96+
set(CMAKE_C_SIMULATE_ID MSVC)
97+
set(CMAKE_C_COMPILER_FRONTEND_VARIANT MSVC)
98+
set(CMAKE_CXX_COMPILER_ID Clang)
99+
set(CMAKE_CXX_SIMULATE_ID MSVC)
100+
set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT MSVC)
95101
else()
96102
set(CMAKE_C_COMPILER ${CLANG_LOCATION}/clang${CMAKE_EXECUTABLE_SUFFIX})
97103
set(CMAKE_CXX_COMPILER ${CLANG_LOCATION}/clang++${CMAKE_EXECUTABLE_SUFFIX})
104+
set(CMAKE_C_COMPILER_ID Clang)
105+
set(CMAKE_CXX_COMPILER_ID Clang)
98106
endif()
99107
else()
100108
message(SEND_ERROR "${target} requires a clang based compiler")

include/swift/ABI/TaskGroup.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ class alignas(Alignment_TaskGroup) TaskGroup {
4242

4343
/// Checks the cancellation status of the group.
4444
bool isCancelled();
45+
46+
// Add a child task to the group. Always called with the status record lock of
47+
// the parent task held
48+
void addChildTask(AsyncTask *task);
4549
};
4650

4751
} // end namespace swift

include/swift/AST/Decl.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3309,6 +3309,9 @@ class NominalTypeDecl : public GenericTypeDecl, public IterableDeclContext {
33093309
/// If the passed in function is not distributed this function returns null.
33103310
AbstractFunctionDecl* lookupDirectRemoteFunc(AbstractFunctionDecl *func);
33113311

3312+
/// Find, or potentially synthesize, the implicit 'id' property of this actor.
3313+
ValueDecl *getDistributedActorIDProperty() const;
3314+
33123315
/// Collect the set of protocols to which this type should implicitly
33133316
/// conform, such as AnyObject (for classes).
33143317
void getImplicitProtocols(SmallVectorImpl<ProtocolDecl *> &protocols);

include/swift/AST/DiagnosticsSema.def

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4681,13 +4681,13 @@ ERROR(distributed_actor_func_static,none,
46814681
ERROR(distributed_actor_func_not_in_distributed_actor,none,
46824682
"'distributed' method can only be declared within 'distributed actor'",
46834683
())
4684-
ERROR(distributed_actor_designated_ctor_must_have_one_transport_param,none,
4684+
ERROR(distributed_actor_designated_ctor_must_have_one_distributedactorsystem_param,none,
46854685
"designated distributed actor initializer %0 must accept exactly one "
4686-
"ActorTransport parameter, found %1",
4686+
"DistributedActorSystem parameter, found %1",
46874687
(DeclName, int))
46884688
ERROR(distributed_actor_designated_ctor_missing_transport_param,none,
46894689
"designated distributed actor initializer %0 is missing required "
4690-
"ActorTransport parameter",
4690+
"DistributedActorSystem parameter",
46914691
(DeclName))
46924692
ERROR(distributed_actor_user_defined_special_property,none,
46934693
"property %0 cannot be defined explicitly, as it conflicts with "

include/swift/AST/Expr.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ class DeclRefExpr : public Expr {
12391239

12401240
/// Set whether this reference must account for a `throw` occurring for reasons
12411241
/// other than the function implementation itself throwing, e.g. an
1242-
/// `ActorTransport` implementing a `distributed func` call throwing a
1242+
/// `DistributedActorSystem` implementing a `distributed func` call throwing a
12431243
/// networking error.
12441244
void setImplicitlyThrows(bool isImplicitlyThrows) {
12451245
Bits.DeclRefExpr.IsImplicitlyThrows = isImplicitlyThrows;
@@ -1619,7 +1619,7 @@ class LookupExpr : public Expr {
16191619

16201620
/// Set whether this reference must account for a `throw` occurring for reasons
16211621
/// other than the function implementation itself throwing, e.g. an
1622-
/// `ActorTransport` implementing a `distributed func` call throwing a
1622+
/// `DistributedActorSystem` implementing a `distributed func` call throwing a
16231623
/// networking error.
16241624
void setImplicitlyThrows(bool isImplicitlyThrows) {
16251625
Bits.LookupExpr.IsImplicitlyThrows = isImplicitlyThrows;
@@ -3615,6 +3615,9 @@ class AbstractClosureExpr : public DeclContext, public Expr {
36153615
/// \brief Return whether this closure is async when fully applied.
36163616
bool isBodyAsync() const;
36173617

3618+
/// Whether this closure is Sendable.
3619+
bool isSendable() const;
3620+
36183621
/// Whether this closure consists of a single expression.
36193622
bool hasSingleExpressionBody() const;
36203623

include/swift/AST/KnownIdentifiers.def

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ IDENTIFIER(decode)
6565
IDENTIFIER(decodeIfPresent)
6666
IDENTIFIER(Decoder)
6767
IDENTIFIER(decoder)
68-
IDENTIFIER(DefaultActorTransport)
68+
IDENTIFIER(DefaultDistributedActorSystem)
6969
IDENTIFIER_(Differentiation)
7070
IDENTIFIER_WITH_NAME(PatternMatchVar, "$match")
7171
IDENTIFIER(dynamicallyCall)
@@ -142,7 +142,6 @@ IDENTIFIER_WITH_NAME(SwiftObject, "_TtCs12_SwiftObject")
142142
IDENTIFIER(SwiftNativeNSObject)
143143
IDENTIFIER(to)
144144
IDENTIFIER(toRaw)
145-
IDENTIFIER(Transport)
146145
IDENTIFIER(Type)
147146
IDENTIFIER(type)
148147
IDENTIFIER(typeMismatch)
@@ -256,18 +255,20 @@ IDENTIFIER_(regexString)
256255
IDENTIFIER_(StringProcessing)
257256

258257
// Distributed actors
259-
IDENTIFIER(transport)
260-
IDENTIFIER(using)
261258
IDENTIFIER(actor)
262-
IDENTIFIER(actorTransport)
263-
IDENTIFIER(actorType)
264259
IDENTIFIER(actorReady)
265-
IDENTIFIER(assignIdentity)
266-
IDENTIFIER(resignIdentity)
260+
IDENTIFIER(ActorSystem)
261+
IDENTIFIER(actorSystem)
262+
IDENTIFIER(ActorID)
263+
IDENTIFIER(actorType)
264+
IDENTIFIER(using)
265+
IDENTIFIER(assignID)
266+
IDENTIFIER(resignID)
267267
IDENTIFIER(resolve)
268+
IDENTIFIER(system)
269+
IDENTIFIER(ID)
268270
IDENTIFIER(id)
269-
IDENTIFIER(identity)
270-
IDENTIFIER(identifier)
271+
IDENTIFIER(Invocation)
271272
IDENTIFIER(_distributedActorRemoteInitialize)
272273
IDENTIFIER(_distributedActorDestroy)
273274
IDENTIFIER(__isRemoteActor)

include/swift/AST/KnownProtocols.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ PROTOCOL(Differentiable)
9898
// Distributed Actors
9999
PROTOCOL(DistributedActor)
100100
PROTOCOL(ActorIdentity)
101-
PROTOCOL(ActorTransport)
101+
PROTOCOL(DistributedActorSystem)
102102

103103
PROTOCOL(AsyncSequence)
104104
PROTOCOL(AsyncIteratorProtocol)

include/swift/AST/KnownSDKDecls.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# define KNOWN_SDK_FUNC_DECL(Module, Name, Id)
2020
#endif
2121

22-
KNOWN_SDK_FUNC_DECL(Distributed, MissingDistributedActorTransport, "_missingDistributedActorTransport")
22+
KNOWN_SDK_FUNC_DECL(Distributed, MissingDistributedActorSystem, "_missingDistributedActorSystem")
2323
KNOWN_SDK_FUNC_DECL(Distributed, IsRemoteDistributedActor, "__isRemoteActor")
2424

2525
#undef KNOWN_SDK_FUNC_DECL

include/swift/AST/PrintOptions.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ class AnyAttrKind {
9595
static_assert(DAK_Count < UINT_MAX, "DeclAttrKind is > 31 bits");
9696
}
9797
AnyAttrKind() : kind(TAK_Count), isType(1) {}
98-
AnyAttrKind(const AnyAttrKind &) = default;
9998

10099
/// Returns the TypeAttrKind, or TAK_Count if this is not a type attribute.
101100
TypeAttrKind type() const {

0 commit comments

Comments
 (0)