Commit Graph

184973 Commits

Author SHA1 Message Date
Artem Chikin
4fb4945ab9 Merge pull request #81908 from artemcm/FixImplicitBuildCXXInteropCycle
[C++Interop] Do not query C++ Standard Library Swift overlays when building Swift modules which were built without C++ interop
swift-DEVELOPMENT-SNAPSHOT-2025-06-03-a
2025-06-02 23:26:27 -07:00
Konrad `ktoso` Malawski
d6a1173bbf Merge branch 'main' into wip-fix-for-real-ptr-auth 2025-06-03 15:12:40 +09:00
Slava Pestov
10f0f6108c Merge pull request #81913 from slavapestov/fix-rdar151479861
AST: Fix crash when type parameter is fixed to an existential
2025-06-03 00:00:03 -04:00
Slava Pestov
02ee1a317b Add regression test for fixed crasher 2025-06-02 23:24:13 -04:00
Saleem Abdulrasool
447b50d573 runtimes: enable reflection by default on ELFish targets
We need reflection enabled as swift-collections uses this which is
required for Foundation. Adjust the defaults to allow building
Foundation for Android again.
2025-06-02 20:12:08 -07:00
Saleem Abdulrasool
08d522a643 Runtimes: repair the Supplemental runtime on Android
Adjust the build rules to account for Android which is a separate
platform from Linux.
2025-06-02 20:03:20 -07:00
Ian Anderson
9a4ba6f5e3 Merge pull request #81914 from ian-twilightcoder/Isystem-fix
[Frontend] -Isystem doesn't work everywhere -I does
2025-06-02 20:02:09 -07:00
Slava Pestov
dc813a08ca Add regression test for fixed crasher 2025-06-02 22:58:29 -04:00
Guillaume Lessard
db7881ef2c [cmake] InoutLifetimeDependence should be enabled
Addresses rdar://152467655
2025-06-02 18:55:13 -07:00
Allan Shortlidge
f4b4dc9889 AST/Sema: Fix remapping of iOS availability in diagnostics for visionOS.
When compiling for visionOS, iOS availability attributes are remapped into the
visionOS availability domain automatically. While the version remapping was
being performed correctly, there was a regression that caused the platform name
to be printed incorrectly in many diagnostics. Whenever an iOS version is
remapped to a visionOS version, availability diagnostics will now present
those versions as visionOS versions instead of iOS versions.

Resolves rdar://146293165.
2025-06-02 17:55:38 -07:00
Pavel Yaskevich
71a8d8d8a4 [CSDiagnostics] Attempt fix-its for contextual generic argument mismatches 2025-06-02 17:39:56 -07:00
Saleem Abdulrasool
12e18ea5d4 utils: repair the Android build
Adjust the parameters to the runtime libraries to ensure that we are
building the runtimes for Android properly.
2025-06-02 17:39:39 -07:00
Saleem Abdulrasool
ce681898b3 runtimes: add Android search handling for SwiftCore
This updates the search handling to account for Android SDK searches on
Windows. This is required to repair the nightly builds.
2025-06-02 17:36:18 -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
Doug Gregor
bfa991d5b3 Merge pull request #81910 from DougGregor/unsafe-string-interpolation
[Strict memory safety] Adjust "unsafe" location for string interpolations
2025-06-02 17:16:10 -07:00
Bassam (Sam) Khouri
911e9f95ff Merge pull request #81664 from swiftlang/revert-81217-t/main/swiftpm_no-assertion-on-linux
Revert "preset: build with no assertion for swiftpm on linux"
2025-06-02 20:06:17 -04:00
Michael Gottesman
7d82d72b22 Merge pull request #81909 from gottesmm/pr-775f782ff711827a2a0dce73a522b6eb9bc2d484
[rbi] Lookthrough an invocation of DistributedActor.asLocalActor when determining actor instances.
2025-06-02 17:04:18 -07:00
Slava Pestov
d8e418a0f9 AST: Fix crash when type parameter is substituted with an existential
getContextSubstitutionMap() didn't handle the case where getAnyNominal()
returns a ProtocolDecl. This should not take the "fast path", which is
only suitable for concrete nominals.

This manifested as a crash-on-invalid -- the user probably meant to write
"T.Value: Collection" rather than "T.Value == Collection".

Fixes rdar://151479861.
2025-06-02 19:17:21 -04:00
Slava Pestov
6e91fa8f96 Merge pull request #81907 from slavapestov/requires-asserts
These tests require asserts
2025-06-02 19:13:53 -04:00
Meghana Gupta
ba678b5518 Merge pull request #81893 from meg-gupta/lifetimediagnostics
Fix diagnostic messages for some cases of invalid lifetime dependencies
2025-06-02 16:01:00 -07:00
Fabrice de Gans
72dad03924 Simplify ucrt.modulemap 2025-06-02 15:24:43 -07:00
Fabrice de Gans
6f9876a565 Platform: Update module maps for the static SDK
Building with the Windows static SDK uncovered issues in the Windows
module maps. Some of the headers were missing and others had incorrect
layering. This updates the module maps to build with the static Windows
SDK.
2025-06-02 15:24:17 -07:00
Ian Anderson
a1d10ed6e7 [Frontend] -Isystem doesn't work everywhere -I does
We missed a spot where we need to pass -Isystem along with -I.

rdar://152267441
2025-06-02 15:06:32 -07:00
Konrad 'ktoso' Malawski
7305efabdd [Concurrency] Prefer swift_auth_code_function over swift_auth_code
This allows us to use constants, and not hardcoded numbers
2025-06-03 06:59:42 +09:00
Anthony Latsis
57b56a0937 Merge pull request #81904 from AnthonyLatsis/сковорода
runtime: Silence a `-Wglobal-constructors` error than appears with up…
2025-06-02 22:43:36 +01:00
Artem Chikin
5b501ad2c5 Hard-code the 'Darwin' module as having been built without C++ interop
Textual interfaces for 'Darwin' built with recent compilers specify that it is built witout C++ interop enabled. However, to ensure compatibility with versions of the 'Darwin' module built with older compilers, we hard-code this fact. This is required to break the module cycle that occurs when building the 'Darwin' module with C++ interop enabled, where the underlying 'Darwin' clang module depends on C++ standard library for which the compiler brings in the 'CxxStdlib' Swift overlay, which depends on 'Darwin'.
2025-06-02 14:16:57 -07:00
Michael Gottesman
ec48e41d42 Merge pull request #81851 from gottesmm/pr-400c59de66fe5c91648aedb348d84cb7bd8d09f4
[flow-isolation] Allow for initialization of fields of a Global Actor isolated class in its nonisolated inits
2025-06-02 13:21:21 -07:00
Doug Gregor
6ba48f2738 [Strict memory safety] Adjust "unsafe" location for string interpolations
String interpolations can end up being unsafe in the call to
appendInterpolation when it's provided with unsafe types. Move the
location of the proposed "unsafe" out to the string interpolation
itself in these cases, which properly suppresses the warning.

Fixes rdar://151799777.
2025-06-02 12:36:36 -07:00
Artem Chikin
5577df7115 [Implicit Module Builds] Do not query CxxStdlib Swift overlay for textual modules which were not built with c++interop
When the compiler is building a module without a defined formal C++ interop mode (e.g. building a textual interface which specifies it was built without C++ interop enabled), avoid looking up the C++ standard library Swift overlay for it. This is required for the case of the Darwin module, for example, which includes headers which map to C++ stdlib headers when the compiler is operating in C++ interop mode, but the C++ standard library Swift overlay module itself depends on 'Darwin', which results in a cycle. To resolve such situations, we can rely on the fact that Swift textual interfaces of modules which were not built with C++ interop must be able to build without importing the C++ standard library Swift overlay, so we avoid specifying it as a dependency for such modules. The primary source module, as well as Swift textual module dependencies which were built with C++ interop will continue getting a direct depedency of the 'CxxStdlib' Swift module.

This was previously fixed in the dependency scanner for explicitly-built modules in https://github.com/swiftlang/swift/pull/81415.
2025-06-02 12:25:59 -07:00
Michael Gottesman
331626e6fa [rbi] Lookthrough an invocation of DistributedActor.asLocalActor when determining actor instances.
In this case, what is happening is that in SILGen, we insert implicit
DistributedActor.asLocalActor calls to convert a distributed actor to its local
any Actor typed form. The intention is that the actor parameter and result are
considered the same... but there is nothing at the SIL level to enforce that. In
this commit, I change ActorInstance (the utility that defines actor identity at
a value level) to look through such a call.

I implemented this by just recognizing the decl directly. We already do this in
parts of SILGen, so I don't really see a problem with doing this. It also
provides a nice benefit that we do not have to modify SILFunctionType to
represent this or put a @_semantic attribute on the getter.

NOTE: Generally, Sema prevents us from mixing together different actors. In this
case, Sema does not help us since this call is inserted implicitly by the
distributed actor implementation in SILGen. So this is not a problem in general.

rdar://152436817
2025-06-02 12:21:55 -07:00
eeckstein
4777f27114 Merge pull request #81897 from eeckstein/fix-mpo
MandatoryPerformanceOptimizations: make sure to handle de-serialized vtable methods
2025-06-02 20:06:32 +02:00
Michael Chiu
84ee0af416 CLongDouble should map to Float128 (which is yet supported) on arm64, and trivial copy ctor is yet available even on 14 2025-06-02 13:39:50 -04:00
Michael Chiu
7bbafc599d Merge branch 'main' into mchiu/freebsd 2025-06-02 13:33:18 -04:00
Slava Pestov
66177e9b9a These tests require asserts 2025-06-02 13:15:01 -04:00
Pavel Yaskevich
e1e9f04398 Merge pull request #81863 from xedin/using-for-default-isolation-in-file-context
[AST/Sema] SE-0478:  Implement `using` declaration under an experimental flag
2025-06-02 09:56:29 -07:00
Saleem Abdulrasool
4ea68a32f9 update_checkout: bump s-a-p to 1.5.1
Update swift-argument-parser to 1.5.1. This is motivated by a change to
the build system in 1.5.1 that is required to build
swift-argument-parser as part of swift-driver to enable static linking
on Windows. Pulling in this change will enable us to make further
progress towards enabling the early swift driver on Windows.
2025-06-02 09:47:27 -07:00
Gábor Horváth
db47bfdab8 Merge pull request #81898 from swiftlang/gaborh/rebranch-test-fix
[cxx-interop] Fix compilation failure in rebranch
2025-06-02 17:38:26 +01:00
Anthony Latsis
8e16bc0644 runtime: Silence a -Wglobal-constructors error than appears with upstream clang
Landing this on main to minimize rebranch-specific changes.
2025-06-02 17:20:57 +01:00
susmonteiro
79227e7a09 [cxx-interop] Fix ambiguous methods in long chains of inheritance 2025-06-02 16:51:58 +01:00
Michael Gottesman
501bad55a8 [flow-isolation] Allow for initialization of fields of a Global Actor isolated class in its nonisolated inits
This just involved loosening some checks in the type checker so we stopped
erroring in the type checker and instead deferred to SIL level checks.

rdar://131136194
2025-06-02 08:37:05 -07:00
Joe Groff
209a7a2ef5 Merge pull request #81878 from jckarter/addressable-scope-for-captures
SILGen: Establish an addressability scope for closure captures.
2025-06-02 07:36:46 -07:00
Hamish Knight
9cad10ddcd [CS] Check hasType in isPlaceholderVar
Patterns assert that a type is set in `getType`, check `hasType`
before querying.

rdar://146383201
2025-06-02 14:33:10 +01:00
Konrad `ktoso` Malawski
503d80699e Don't disable priority escalation tests on arm64e
We carried over all unsupported: marks from task_priority test which seems to have had just racy behavior for ages. This test should be fine on arm64e, and especially, we must run it to verify the pointer auth of these APIs.

This allowed a pointer auth issue to slip through, so let's remedy this by actually running the test on those platforms.
2025-06-02 21:45:04 +09:00
Konrad 'ktoso' Malawski
2c99a669d3 Correct priority cancellation handler signing once more
Resolves rdar://150378890 for real this time, verified on arm64e myself
2025-06-02 21:32:57 +09:00
Gabor Horvath
64babf5ce6 [cxx-interop] Fix compilation failure in rebranch
It looks like in the latest version of clang needs parameters to be
named for the lifetimebound attribute to be applicable.

rdar://151918181
2025-06-02 13:00:55 +01:00
Alastair Houghton
467f401ef1 [Build] Fix availability platform macros.
These need to be defined always; we'll set them to "unknown" and "none"
respectively if they end up being something we don't understand.

rdar://150966361
2025-06-02 11:30:31 +01:00
Erik Eckstein
cf55b9bede MandatoryPerformanceOptimizations: make sure to handle de-serialized vtable methods
When de-serializing a function and this function allocates a class, the methods of the de-serialized vtable must be handled, too.

Fixes an IRGen crash
rdar://152311945
2025-06-02 11:43:34 +02:00
Konrad 'ktoso' Malawski
fb6453c64c [Distributed] IRGen mangler must mangle distributed thunk 2025-06-02 13:34:09 +09:00
Konrad 'ktoso' Malawski
9b3662e526 [Distributed] print distributed(_thunk) in SILPrinter 2025-06-02 13:34:07 +09:00
Stephen Canon
d49dd182ed Simd float concrete comparisons (#81892)
There's no reason for these to ever be calls, so they should be
transparent instead of just aEIC. Also adds concrete versions of
comparisons with scalars, and filecheck tests to make sure these
generate 1-2 instruction sequences in release on arm64 (x86_64 is a
little trickier to test due to frame pointers, but if we get the right
codgen on arm64, in practice we do well on x86_64 for these too).

Also makes filecheck patterns for repeating initializers a bit more
robust.
2025-06-01 20:35:15 -07:00