Commit Graph

21519 Commits

Author SHA1 Message Date
swift-ci
559b5c5923 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-17 23:07:29 -07:00
Allan Shortlidge
1e7cc98a4b Merge pull request #77083 from tshortli/introduce-availability-context 2024-10-17 22:59:52 -07:00
swift-ci
5bfc87531f Merge remote-tracking branch 'origin/main' into rebranch 2024-10-17 18:21:11 -07:00
Allan Shortlidge
47e41855d0 AST/Sema: Adopt AvailabilityContext in TypeRefinementContext.
Begin using `AvailabilityContext` as the availability representation in
`TypeRefinementContext`, instead of only storing platform introduction
availability ranges.

There should be no functional changes since this just changes the
representation of the existing information stored by `TypeRefinementContext`.
However, in the future `AvailabilityContext` will be expanded to represent
additional availability constraints.
2024-10-17 17:32:05 -07:00
Michael Gottesman
0e0665bfbd [concurrency] Add support for HopToMainActorIfNeededThunk.
It is behind the experimental flag GenerateForceToMainActorThunks.
2024-10-17 13:31:39 -07:00
Allan Shortlidge
439c5951ec AST: Introduce AvailabilityContext.
This class is designed to be a compact representation of the active
availability constraints in a specific scope. For now, it only models platform
introduction availability but it will soon be updated to cover additional
availability constraints, like platform unavailability.

In anticipation of needing to reference `AvailabilityContext`s from
`TypeRefinementContext`s and increasing memory requirements for these contexts,
a cache of uniqued instances of `AvailabilityContext` are stored in a
`llvm::FoldingSet` on `ASTContext`.
2024-10-17 11:26:28 -07:00
Michael Gottesman
f0f5ad54fd [thunk-lowering] Add support for mangling identity thunks.
This is just again using identity thunks to show that the behavior works before
I add in hop to main actor.
2024-10-17 11:17:38 -07:00
swift-ci
e90f070b60 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-17 08:08:55 -07:00
Gábor Horváth
9325512998 Merge pull request #77025 from swiftlang/gaborh/support-objc-protocols
[cxx-interop] Support ObjC protocols in C++ interop
2024-10-17 15:38:17 +01:00
swift-ci
9fbade9185 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-16 18:42:10 -07:00
Allan Shortlidge
4c45a4d9d8 AST: Fix the formatting and content of TypeRefinementContext verifier errors. 2024-10-16 14:14:39 -07:00
Gabor Horvath
0e03d342fe [cxx-interop] Support ObjC protocols in C++ interop
This patch introduces handling of ObjC protocols similar to how ObjC
classes work. Since this only works in ObjC++, all declarations
containing ObjC protocols will be protected by the __OBJC__ macro.

This patch results in some `_bridgeObjC` methods being exposed, we might
end up hiding those in the future, but there is no harm having them in
the interop header for the interim period.

rdar://136757913
2024-10-16 18:51:35 +01:00
swift-ci
4ac1f2887f Merge remote-tracking branch 'origin/main' into rebranch 2024-10-15 10:16:56 -07:00
Egor Zhdan
844d103f0d Merge pull request #77006 from swiftlang/egorzhdan/cxx-contiguous
[cxx-interop] Add `UnsafeCxxContiguousIterator` & `UnsafeCxxMutableContiguousIterator` protocols
2024-10-15 19:01:15 +02:00
Egor Zhdan
3a200deee9 [cxx-interop] Add UnsafeCxxContiguousIterator & UnsafeCxxMutableContiguousIterator protocols
This adds a pair of Swift protocols that represents C++ iterator types conforming to `std::contiguous_iterator_tag` requirements. These are random access iterators that guarantee that the values are stored in consequent memory addresses.

This will be used to optimize usage of C++ containers such as `std::vector` from Swift, for instance, by providing an overload of `withContiguousStorageIfAvailable` for contiguous containers.

rdar://137877849
2024-10-15 14:30:09 +01:00
swift-ci
fa5fc7948e Merge remote-tracking branch 'origin/main' into rebranch 2024-10-14 21:45:47 -07:00
Allan Shortlidge
7819dd7833 AST/Sema: Remove unnecessary ASTContext parameters from availability APIs.
Many of the methods on `AvailabilityInference` take both a `Decl` and an
`ASTContext`, which is redundant.
2024-10-14 17:46:53 -07:00
swift-ci
ad721b21c9 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-14 15:33:31 -07:00
Rintaro Ishizaki
e4dc04d564 [Macros] Reap plugin process as soon as it ends 2024-10-14 09:44:38 -07:00
swift-ci
02074b566b Merge remote-tracking branch 'origin/main' into rebranch 2024-10-13 13:13:52 -07:00
Rintaro Ishizaki
66138e8395 [ASTGen] Generate ForceValueExpr and BindOptionalExpr 2024-10-13 07:30:36 -07:00
swift-ci
ce9c86722d Merge remote-tracking branch 'origin/main' into rebranch 2024-10-12 11:34:21 -07:00
Holly Borla
2f33d875d9 Merge pull request #76988 from hborla/init-checking-order
[Sema] Fix an issue with the ordering of effects checking and actor isolation checking.
2024-10-12 11:21:33 -07:00
Hamish Knight
7c3f965578 Merge pull request #76979 from hamishknight/regex-request
Requestify regex pattern parsing
2024-10-12 19:19:09 +01:00
swift-ci
61fa7d51fa Merge remote-tracking branch 'origin/main' into rebranch 2024-10-11 21:45:39 -07:00
Allan Shortlidge
6c18bf2932 Merge pull request #76989 from tshortli/remove-trc-explicit-availability 2024-10-11 21:42:39 -07:00
Holly Borla
e1bf19822d [Sema] Put effects checking behind a request for experimental lazy
type checking.
2024-10-11 20:33:38 -07:00
Allan Shortlidge
6bc9cf5e43 AST: Remove ExplicitAvailabilityInfo from TypeRefinementContext.
This field was complicating initialization of `TypeRefinementContext` and
bloating its storage just to make it slightly more convenient to look up
information that is pretty easy to derive on-demand when it is actually needed.
2024-10-11 17:10:38 -07:00
swift-ci
8a2edbc4c5 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-11 17:05:06 -07:00
nate-chandler
249831f9f3 Merge pull request #76942 from nate-chandler/general-coro/20240927/1
[CoroutineAccessors] SIL represents callee alloc.
2024-10-11 16:39:53 -07:00
swift-ci
3fbd2b5151 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-11 13:15:53 -07:00
Rintaro Ishizaki
9461af4c5a Merge pull request #76978 from rintaro/astgen-placeholderexpr
[ASTGen] Generate EditorPlaceholderExpr and 'do' expressions
2024-10-11 13:12:21 -07:00
Hamish Knight
6a435960b7 Requestify regex pattern parsing
Instead of doing the pattern parsing in both the
C++ parser and ASTGen, factor out the parsing into
a request that returns the pattern to emit, regex
type, and version. This can then be lazily run
during type-checking.
2024-10-11 19:25:58 +01:00
Hamish Knight
21cbfc4567 NFC: Remove unused var 2024-10-11 19:25:57 +01:00
swift-ci
e1cfbb45cc Merge remote-tracking branch 'origin/main' into rebranch 2024-10-11 11:19:47 -07:00
Anthony Latsis
8519334b89 Merge pull request #76749 from AnthonyLatsis/amanita-muscaria 2024-10-11 18:02:36 +00:00
Rintaro Ishizaki
cb6372a9c4 [ASTGen] Generate EditorPlaceholderExpr and 'do' expressions 2024-10-11 09:34:41 -07:00
Nate Chandler
49a2831d3f [CoroutineAccessors] Old ABI may be used via flag.
Add a setting to IRGenOptions and key off of it to emit yield_once_2
coroutines using either (1) the same code-path as yield_once coroutines
or (2) a new, not-yet implemented code-path.

Add flags to set the value in both directions.  During bringup, by
default, use the existing caller-allocated ABI.
2024-10-11 08:25:02 -07:00
Nate Chandler
11b5d27594 [CoroutineAccessors] Add flag to observe errors.
Temporarily allow the legacy behavior of allowing caller coroutine
accessors to observe errors (i.e. by executing no code after the yield
if the caller threw an error) behind the
CoroutineAccessorsUnwindOnCallerError flag.
2024-10-11 08:25:02 -07:00
Nate Chandler
df1c4f6b25 [CoroutineAccessors] Add new SILFnTy CoroKind.
For `modify` and `read` coroutines, produce SILFunctionType's whose
coroutineKind is ::YieldOnce2.
2024-10-11 08:25:02 -07:00
swift-ci
eb44cd10be Merge remote-tracking branch 'origin/main' into rebranch 2024-10-10 23:13:50 -07:00
Allan Shortlidge
4acfd20f04 Merge pull request #76972 from tshortli/trc-expansion-request-side-effect 2024-10-10 22:59:27 -07:00
swift-ci
5fa6829c78 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-10 19:47:48 -07:00
Allan Shortlidge
5440dcef92 AST: Make ExpandChildTypeRefinementContextsRequest a side effectful request.
While returning the actual child vector from
`ExpandChildTypeRefinementContextsRequest` is a nice idea, it is both
inefficient (the vector gets copied in and out) and kind of inaccurate, since
the vector remains mutable after the initial expansion and may gain additional
children as macros are lazily expanded.
2024-10-10 18:06:39 -07:00
Anthony Latsis
41adfec8da [NFC] AST, Sema: Move TypeChecker::findReturnStatements into AnyFunctionRef
Also rename it to `getExplicitReturnStmts` for clarity and have it
take a `SmallVector` out parameter instead as a small optimization and
to discourage use of this new method as an alternative to
`AnyFunctionRef::bodyHasExplicitReturnStmt`.
2024-10-11 03:57:43 +03:00
Anthony Latsis
c7ea672463 [NFC] AST, Sema: Internalize BraceHasReturnRequest evaluation in AnyFunctionRef method 2024-10-11 03:44:43 +03:00
Konrad `ktoso` Malawski
6f245bb8eb ABI comments: include stored property names 2024-10-11 08:01:43 +09:00
swift-ci
1a59843e00 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-10 09:15:22 -07:00
Gábor Horváth
b5a85ed8dc Merge pull request #76907 from swiftlang/gaborh/assume-resilient-cxx-types
[cxx-interop] Add flag to assume C++ types are resilient
2024-10-10 17:15:15 +01:00
swift-ci
6c5df94ea4 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-09 22:54:18 -07:00