Commit Graph

2158 Commits

Author SHA1 Message Date
Meghana Gupta
a0c939bd3b Use @inout result convention for mutate accessors 2025-10-20 09:05:32 -07:00
Doug Gregor
39a36d9216 Merge pull request #84948 from DougGregor/extern-c-asmname
[SILGen] Map the @_extern(c) C function name over to the asmname of a SIL function
2025-10-16 18:27:00 -07:00
Doug Gregor
1ca9235de6 [Serialization] Record the new SIL_EXTRA_STRING block
Also fix up a test
2025-10-16 08:00:40 -07:00
Hamish Knight
364eba482d [AST] Use CustomAttr's DeclContext for ResolveMacroRequest
Remove the DeclContext parameter from ResolveMacroRequest, we can now
retrieve the DeclContext either from the CustomAttr or macro expansion
expr/decl directly.
2025-10-16 11:21:54 +01:00
Allan Shortlidge
b9fd3e4604 Merge pull request #84778 from tshortli/swift-runtime-availability-domain
AST: Introduce a Swift runtime availability domain
2025-10-09 08:53:20 -07: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
Slava Pestov
0d90b62491 AST: Clean up in preparation for non-canonical archetypes 2025-10-08 15:15:43 -04:00
Hamish Knight
954b08cae5 [AST] Remove UnresolvedType
We have now removed all uses of this type.
2025-10-03 09:50:42 +01: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
d5a03fa0e4 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-26 22:36:42 -07:00
Erik Eckstein
a322fd9209 Serialization: remove the IS_OSSA flag from the module file header 2025-09-26 08:01:08 +02:00
swift-ci
0d2c4ca9be Merge remote-tracking branch 'origin/main' into rebranch 2025-09-15 10:29:21 -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
a99470e579 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-08 07:13:18 -07:00
Richard Howell
7296b28b08 Debug prefix macro search paths
Macro search paths are generally absolute paths which will cause
non-deterministic output for build systems that build remotely.
When the -prefix-serialized-debugging-options flag is set remap
the macro search paths as well as the other debug paths.
2025-09-05 14:09:23 -07:00
swift-ci
07b17d605e Merge remote-tracking branch 'origin/main' into rebranch 2025-09-04 06:17:38 -07:00
Doug Gregor
ed93b46fa6 [Embedded] Introduce DeferredCodeGen feature.
Introduce an experimental feature DeferredCodeGen, that defers the
generation of LLVM IR (and therefore object code) for all entities
within an Embedded Swift module unless they have explicitly requested
to not be emitted into the client (e.g., with
`@_neverEmitIntoClient`).

This feature is meant to generalize and subsume
-emit-empty-object-file, relying on lazy emission of entities rather
than abruptly ending the compilation pipeline before emitting any IR.

Part of rdar://158363967.
2025-09-03 15:55:47 -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
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
3787a312d7 Merge remote-tracking branch 'origin/main' into rebranch 2025-07-15 17:17:19 -07:00
Allan Shortlidge
d09e117dc0 AST: Canonicalize platform versions for @backDeployed attrs.
Also, diagnose invalid platform versions.

Part of rdar://155558161.
2025-07-14 16:40:16 -07:00
Allan Shortlidge
910989c2c2 AST: Store parsed version in OriginallyDefinedInAttr instead of canonical.
Canonicalize the version on-demand instead.

NFC, part of rdar://155558161.
2025-07-14 16:04:04 -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
d5a8982db5 Merge remote-tracking branch 'origin/main' into rebranch 2025-07-01 00:37:27 -07:00
Pavel Yaskevich
907606ef28 [Serialization] A temporary fix for LocatableType
Gracefully handle `LocatableType` types if they show up during
serialization. This is a temporary fix until we can remove
`TransitivelyConformsTo` constraint from the solver which is
the underlying cause of the issue (see https://github.com/swiftlang/swift/pull/82541).

Resolves: rdar://153461854
2025-06-30 14:53:36 -07: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
Anthony Latsis
3e9923f0c0 ASTBridging: Bridge swift::AccessorKind directly 2025-06-19 04:26:52 +01:00
Anthony Latsis
6e9d9e175d ClangImporter: Conservatively handle new clang::HLSLInlineSpirvType type
See https://github.com/llvm/llvm-project/pull/134034
2025-06-13 21:57:37 +01:00
Meghana Gupta
d1a97f1b0d Merge pull request #81879 from meg-gupta/fixdeserialization
Fix deserialization of lifetime dependencies on ast function types
2025-06-03 08:56:54 -07:00
Meghana Gupta
36f3574f9c Fix deserialization of lifetime dependencies on ast function types
While deserializing AST function types FunctionType and GenericFunctionType which include
lifetime dependencies and an implicit self parameter, we don't correctly populate
ASTExtInfoBuilder.lifetimeDependencies.  We end up reading one dependency less due to
incorrect index calculation.

Unlike SILFunctionType, AST function types FunctionType and GenericFunctionType
do not include implicit self in their param list. They represent methods with
implicit self as like: `(Self) -> (Args...) -> Result` and don't have any information
to indicate they may have implicit self. Since we use number of parameters while
deserializing lifetime dependencies, we go wrong for such function types.

Serialize the length of parameter indices, so that lifetime dependencies can be
deserialized to that length.

rdar://151768216
2025-06-02 17:29:05 -07:00
Pavel Yaskevich
bc61bfb442 [Serialization] Prevent using declarations from being serialized 2025-05-31 11:10:39 -07:00
Pavel Yaskevich
aabfebec03 [AST] Add new declaration - using
Initially this declaration is going to be used to determine
per-file default actor isolation i.e. `using @MainActor` and
`using nonisolated` but it could be extended to support other
file-global settings in the future.
2025-05-30 00:39:06 -07:00
Arnold Schwaighofer
13ff5abdb8 Introduce @specialized attribute
Implements SE-0460 -- the non-underscored version of @specialized.

It allows to specify "internal" (not abi affecting) specializations.

rdar://150033316
2025-05-23 13:12:47 -07:00
Hamish Knight
d672f750e7 [Basic] Rename abortWithPrettyStackTraceMessage to ABORT
Turn it into a wrapping macro that includes the file location, and
move into `Assertions.h`.
2025-05-19 20:55:01 +01:00
Pavel Yaskevich
04d46760bb [AST] Extend @_inheritActorContext attribute to support optional always modifier
By default (currently) the closure passed to a parameter with `@_inheritActorContext`
would only inherit isolation from `nonisolated`, global actor isolated or actor
context when "self" is captured by the closure. `always` changes this behavior to
always inherit actor isolation from context regardless of whether it's captured
or not.
2025-05-14 20:07:57 -07:00
Becca Royal-Gordon
b6be85222f Standardize serialization of DeclNameRefs
There are four attributes which serialize out a DeclNameRef, sometimes by dropping some of its components. Standardize them with a representation that can handle module selectors.
2025-05-14 11:16:30 -07:00
Michael Gottesman
9d59dbed17 [swift-settings] Now that we aren't using it immediately, remove it from tree.
We can always get it back from the git history.

rdar://150695113
2025-05-05 13:39:03 -07:00