Commit Graph

1619 Commits

Author SHA1 Message Date
Doug Gregor
1bae4da121 [Deserialization] Require labels to match when looking for closely-matching clang declarations 2025-11-02 08:32:50 -08:00
Doug Gregor
38c23bcdda [Serialization] Allow near-misses when matching imported Clang declarations
Fixes the rest of rdar://137014448.
2025-11-02 07:21:15 -08:00
Allan Shortlidge
463bf91f68 AST: Rename Swift runtime availability domain to StandaloneSwiftRuntime.
This name will distinguish the standalone Swift runtime availability domain
from the domain for the built-in Swift runtime on supported targets.
2025-10-21 21:55:25 -07:00
Alexis Laferrière
afcbd35868 Merge pull request #84958 from xymus/deser-witness
Serialization: Fix null dereference in witness deserialization
2025-10-20 15:11:23 -07:00
Meghana Gupta
a0c939bd3b Use @inout result convention for mutate accessors 2025-10-20 09:05:32 -07:00
Hamish Knight
73710e3eef [AST] Introduce Decl::addAttribute
Introduce a convenience entrypoint that also calls `attachToDecl` on
the attribute, and migrate all existing uses of `getAttrs().add` onto
it.
2025-10-16 11:21:54 +01:00
Hamish Knight
0358e1eadd [AST] Consolidate attribute attachment logic
Introduce `DeclAttribute::attachToDecl` which is the now the main
entry point for associating an attribute with a decl. Different
attributes can implement `attachToDeclImpl` to add their custom logic.
Move DifferentiableAttr, DerivativeAttr, CustomAttr, and ABIAttr over
to this new logic.
2025-10-16 11:21:54 +01:00
Alexis Laferrière
1db5ad0c4c Serialization: Fix null dereference in witness deserialization
Fix null dereference in deserialization logic for conformances. If
deserializing the witness itself failed, don't try to
get its actor isolation.

rdar://162158608
2025-10-14 16:39:54 -07:00
Hamish Knight
2b8a1cccfd [AST] Store owning Decl/DeclContext on CustomAttr
Introduce CustomAttrOwner that can store either a Decl for an
attached attribute, or a DeclContext for e.g a type or closure
attribute. Store this on CustomAttr such that we can query it from
the name lookup requests.
2025-10-13 13:37:29 +01:00
Allan Shortlidge
1a86cd9c26 AST: Introduce a Swift runtime availability domain.
Add support for the `Swift` availability domain, which represents availability
with respect to the Swift runtime. Use of this domain is restricted by the
experimental feature `SwiftRuntimeAvailability`.
2025-10-08 17:31:57 -07:00
Allan Shortlidge
4e9a883824 AST: Rename SwiftLanguage availability domain kind to SwiftLanguageMode. 2025-10-08 15:46:34 -07:00
Mishal Shah
03a599c5be Merge pull request #84606 from swiftlang/rebranch
Merge clang 21.x rebranch into main
2025-10-02 20:17:05 -07:00
Alejandro Alonso
dd006e073a Serialize isAddressable on param decls 2025-10-01 11:07:48 -07:00
Gábor Horváth
e8784b8c10 Merge pull request #83827 from Xazax-hun/const-ref-crash-take-4
[SILGen] Fix the type of closure thunks that are passed const references
2025-10-01 09:56:06 +01:00
swift-ci
0d2c4ca9be Merge remote-tracking branch 'origin/main' into rebranch 2025-09-15 10:29:21 -07:00
Meghana Gupta
c764244df0 Merge pull request #84180 from meg-gupta/borrowandmutatepr
Add preliminary support for borrow accessors
2025-09-15 10:01:15 -07:00
swift-ci
48eb65ee53 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-11 08:04:53 -07:00
Doug Gregor
f318cf328d [Serialization] Don't fatalError earlier than we have to
Noticed as part of rdar://160278232.
2025-09-10 16:43:15 -07:00
Meghana Gupta
1cff471c57 Introduce ResultConvention::Guaranteed and ResultConvention::GuaranteedAddress
ResultConvention::Guaranteed will be used by borrow accessors when the storage type can be returned by value.

ResultConvention::GuaranteedAddress will be used by mutate accessors and borrow accessors when the storage type
cannot be returned by value.
2025-09-09 14:45:40 -07:00
Meghana Gupta
9fe489ce22 Introduce borrow and mutate as new accessor kinds
And handle them in various covered switches
2025-09-09 14:30:26 -07:00
Gabor Horvath
f26749245b [SILGen] Fix the type of closure thunks that are passed const reference structs
This PR is another attempt at landing #76903. The changes compared to
the original PR:
* Instead of increasing the size of SILDeclRef, store the necessary type
  information in a side channel using withClosureTypeInfo.
* Rely on SGFContext to get the right ClangType
* Extend BridgingConversion with an AbstractionPattern to store the
  original clang type.
* The PR above introduced a crash during indexing system modules that
  references foreign types coming from modules imported as
  implementation only. These entities are implementation details so they
  do not need to be included during serialization. This PR adds a test
  and adds logic to exclude such clang types in the serialization
  process.

rdar://131321096&141786724
2025-09-09 12:07:52 +01:00
swift-ci
7395dd8af2 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-03 12:20:00 -07:00
Hamish Knight
7fb532e4e6 Merge pull request #83776 from hamishknight/the-diags-never-stop-no
[Diags] Allow multiple in-flight diagnostics
2025-09-03 19:59:44 +01:00
Hamish Knight
89feb8fabb [Diags] Remove some now unnecessary calls to flush 2025-08-17 11:48:21 +01:00
swift-ci
ab9176fa4b Merge remote-tracking branch 'origin/main' into rebranch 2025-08-16 02:24:41 -07:00
Allan Shortlidge
678b0934d6 AST: Request-ify getting the AvailabilityDomain from a ValueDecl.
Cache the result of turning a `ValueDecl` into an `AvailabilityDomain`. Use
split caching to make the common case of the decl not representing an
availability domain efficient.

NFC.
2025-08-15 16:15:36 -07:00
swift-ci
fdc5b2bc73 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-14 19:55:30 -07:00
Allan Shortlidge
0bba9bbc26 AST: Make the decl associated with an AvailabilityDomain a ValueDecl.
A decl that represents an `AvailabilityDomain` should always be a `ValueDecl`.
2025-08-14 11:35:00 -07:00
swift-ci
38dbbf0747 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-08 12:54:14 -07:00
Pavel Yaskevich
4e445d1483 Merge pull request #83556 from xedin/rename-nonisolated-caller-to-nonsending
[AST] NFC: Rename function type isolation `NonisolatedCaller` to `Non…
2025-08-08 09:37:17 -07:00
Anthony Latsis
ece73d8004 Manually merge remote-tracking branch 'origin/main' into rebranch
Conflicts:
-	include/swift/AST/Decl.h
2025-08-07 15:31:16 +01:00
Allan Shortlidge
b4fb7c81c0 AST: Refactor AvailabilityQuery constructors.
Get rid of the boolean arguments for unavailability in AvailabilityQuery's
constructors and introduce a `asUnavailable()` modifier that can be used
instead in the contexts where unavailability is relevant.
2025-08-06 18:01:44 -07:00
Allan Shortlidge
78f50ba741 AST: Refactor ConditionallyAvailableSubstitutions to use AvailabilityQuery.
Conditionally available opaque return types should support availability
conditions that are evaluated in any availability domain. Update
`ConditionallyAvailableSubstitutions` to model its conditions with
`AvailabilityQuery` instead of assuming that conditions are always a single
version query for the current platform.
2025-08-06 18:01:10 -07:00
Pavel Yaskevich
53ef38e31b [AST] NFC: Rename function type isolation NonisolatedCaller to NonisolatedNonsending
This reduces the number of ways we refer to caller isolated async
functions and matches the name to the attribute spelling.
2025-08-05 17:22:10 -07:00
swift-ci
3998a187f9 Merge remote-tracking branch 'origin/main' into rebranch 2025-07-30 09:36:41 -07:00
Anthony Latsis
fec049e5e4 Address llvm::PointerUnion::{is,get} deprecations
These were deprecated in
https://github.com/llvm/llvm-project/pull/122623.
2025-07-29 18:37:48 +01:00
swift-ci
367f0082fc Merge remote-tracking branch 'origin/main' into rebranch 2025-07-22 22:17:45 -07:00
Anthony Latsis
2920ea84d1 Address llvm::(Mutable)ArrayRef ctor deprecations
See:
- https://github.com/llvm/llvm-project/pull/146113
- https://github.com/llvm/llvm-project/pull/146011
2025-07-21 12:36:53 +01:00
Anthony Latsis
59957f5bbf Serialization: Adjust call to clang::AttributeCommonInfo ctor
See https://github.com/llvm/llvm-project/pull/141305.
2025-07-19 02:00:41 +01:00
Anthony Latsis
c1d794364b Adjust code after changes to llvm::TrailingObjects API
See:
- https://github.com/llvm/llvm-project/pull/138970
- https://github.com/llvm/llvm-project/pull/144930
2025-07-19 01:48:18 +01:00
swift-ci
e83d6f9537 Merge remote-tracking branch 'origin/main' into rebranch 2025-07-14 15:58:05 -07:00
Alexis Laferrière
1d035f2aaf Serialization: Align conformance recovery logic across modes
Always give up early when attempting to deserialize a protocol
conformance broken by a context change. Don't attempt to replace missing
members of the conformance signature with invalid one, just mark the
whole protocol conformance as invalid.

The previous recovery logic, only for SourceKit mode and LLDB, was
inserting invalid conformances in the signature instead of dropping the
whole protocol conformance. It lead to failures later in the same
`finishNormalConformance` when accessing the invalid conformances.

rdar://98925842
2025-07-11 10:14:00 -07:00
swift-ci
2b8612c203 Merge remote-tracking branch 'origin/main' into rebranch 2025-07-08 00:16:43 -07:00
Pavel Yaskevich
43eec8fede [AST/Sema] SE-0487: Expand @nonexhaustive attribute to support warn argument
The spelling `@nonexhaustive(warn)` replaces `@preEnumExtensibility`
attriubte.
2025-07-04 10:20:25 -07:00
swift-ci
4668d6c04c Merge remote-tracking branch 'origin/main' into rebranch 2025-06-26 13:55:39 -07:00
Anthony Latsis
1f89bb6a94 Merge pull request #82452 from swiftlang/jepa2
Sema: Fix the insertion location for conformances attributes
2025-06-26 21:38:41 +01:00
Anthony Latsis
ad8c52237c Sema: Fix the insertion location for conformances attributes 2025-06-24 14:49:03 +01:00
swift-ci
1a1486e792 Merge remote-tracking branch 'origin/main' into rebranch 2025-06-23 22:18:31 -07:00
Meghana Gupta
adceb7abc3 Serialize/deserialize lifetime dependencies on enum elements 2025-06-23 13:42:54 -07:00
swift-ci
9a08a18af2 Merge remote-tracking branch 'origin/main' into rebranch 2025-06-20 15:45:44 -07:00