Commit Graph

21665 Commits

Author SHA1 Message Date
Allan Shortlidge
a85caaf296 Concurrency: Address new -strict-memory-safety warnings. 2025-05-18 10:37:19 -07:00
Saleem Abdulrasool
3b968f699a CommandLineSupport: add a directive for autolinking on Windows
We use functions from Shell32.Lib. Ensure that we indicate the
autolinking to the linker. This aides when building with a static
runtime to avoid having to specify the additional library dependency for
clients that are attempting to link against the runtime. This is
particularly important for the CMake compiler check where we would need
to list Shell32 as a required link library.
2025-05-17 18:31:31 -07:00
Karoy Lorentey
02adf95cfb Merge pull request #78799 from lorentey/note-cas-loops
[doc] Atomic.add, .subtract: Add note on atomic codegen
2025-05-16 19:05:10 -07:00
Karoy Lorentey
d98002318d [stdlib][runtime] Establish Swift Stdlib/runtime version 6.3 2025-05-16 19:01:32 -07:00
Pavel Yaskevich
c3c1b4fca0 [stdlib] Adopt @_inheritActorContext(always) on Task.immediate
This change aligns implementation with the current SE-0472 proposal.
2025-05-16 14:27:46 -07:00
Mike Ash
aea9c0c65a [Runtime] Allow weak references to ErrorObjects.
When ObjC interop is not available, Error values are represented in ErrorObject boxes. These are full HeapObjects, but unowned refcounting ops asserted that the metadata was class metadata. This assert would be hit when destroying an ErrorObject that was weakly referenced. Expand the asserts to accept ErrorObject metadata as well.

rdar://150214921
2025-05-16 14:01:29 -04:00
David Smith
e795eb0d13 Cache the last ObjC bridging conformance we looked up (#81545)
Fixes rdar://151475392
2025-05-16 11:00:13 -07:00
Alastair Houghton
7f97e8d10b Merge pull request #81472 from al45tair/eng/PR-151147606
[Concurrency] Add underscore prefixes for not yet official API.
2025-05-15 18:39:21 +01:00
Alastair Houghton
b2f0d92eaa [Cxx] Build the C++ interop support library for the Static SDK for Linux.
We need the C++ interop support library to make the build work, as
the Runtime module uses C++ interop.

(Also, we should build it, because some user programs might want to
use C++ interop.)

rdar://147201087
2025-05-15 14:30:12 +01:00
Saleem Abdulrasool
0af5839320 Merge pull request #81477 from compnerd/conwarn
Concurrency: silence warning on Windows
2025-05-14 09:45:08 -07:00
Alastair Houghton
c0ccdffeb7 [Concurrency] Add underscore prefixes for not yet official API.
Custom main and global executors work hasn't passed Swift Evolution yet,
so we need to avoid leaking it as API until it does.

To that end, underscore all the things.

rdar://151147606
2025-05-14 11:57:06 +01:00
Saleem Abdulrasool
f411fcd388 CommandLineSupport: prefer _strdup over strdup
This silences a warning on Windows as `strdup` is considered deprecated
in favour of the POSIX compliant `_strdup` spelling.
2025-05-13 13:21:01 -07:00
Saleem Abdulrasool
cab1f40218 Concurrency: silence warning on Windows
Prefer `strncpy_s` over `strncpy` which triggers a warning. This
function ensures that the copied string is null-terminated if the string
fits or simply returns an empty string (`\0`) if the string does not
fit. Prefer to use `_TRUNCATE` to copy as much of the name as fits and
ensure that it is null-terminated.
2025-05-13 09:48:33 -07:00
eeckstein
66e07f04ac Merge pull request #81441 from eeckstein/vector_base_addr
SIL: introduce the `vector_base_addr` instruction and use it in `InlineArray`
2025-05-13 06:52:42 +02:00
Alejandro Alonso
9e24563bb7 Merge pull request #81365 from Azoy/my-existentials
[AST & Runtime] Correctly mangle extended existentials with inverse requirements
2025-05-12 13:21:07 -07:00
Alastair Houghton
485b8f6888 Merge pull request #81446 from al45tair/eng/PR-150531873
[Concurrency] Remove deprecation attribute for now.
2025-05-12 20:02:03 +01:00
Erik Eckstein
e3f25d710d stdlib: make InlineArray work with the new vector_base_addr instruction
Don't unsafe-cast from the InlineArray struct itself, but from `_storage` which is the actual array buffer.
This also requires making `_storage` a var.
2025-05-12 19:25:12 +02:00
Egor Zhdan
ede6e468e0 Merge pull request #81408 from swiftlang/egorzhdan/do-not-install-swiftmodules
[cxx-interop] Do not install binary `.swiftmodule` files for the overlays
2025-05-12 17:29:52 +01:00
Pavel Yaskevich
3854e61c49 Merge pull request #81428 from xedin/rename-some-task-apis
[stdlib] SE-0472: Rename `Task` and`*TaskGroup` APIs to match the pro…
2025-05-12 09:13:11 -07:00
Alastair Houghton
c6d1969afc [Concurrency] Remove deprecation attribute for now.
This deprecation attribute is possibly a little premature.

rdar://150531873
2025-05-12 15:35:45 +01:00
Alastair Houghton
28f96e64ab [Concurrency][Stdlib] Add SwiftStdlibCurrentOS availability, use it.
If you use SwiftStdlibCurrentOS availability, you will be able to
use new types and functions from within the implementation. This
works by, when appropriate, building with the CurrentOS availability
set to the current deployment target.

rdar://150944675
2025-05-12 12:07:24 +01:00
Egor Zhdan
16b280862a [cxx-interop] Do not install binary .swiftmodule files for the overlays
This fixes a deserialization failure in the compiler that occurred while loading the CxxStdlib overlay module:
```
Cross-reference to module 'Swift'
... Optional
... some
... with type <τ_0_0 where τ_0_0 : ~Copyable, τ_0_0 : ~Escapable> (Optional<τ_0_0>.Type) -> (τ_0_0) -> Optional<τ_0_0>
```

This was happening because the overlays were built against a different version of the Swift stdlib than is being used. The compiler is able to rebuild the Cxx and CxxStdlib modules from their textual interfaces. Let's use that feature unconditionally in production toolchains to avoid this kind of binary incompatibilities.

rdar://150416863
2025-05-10 22:55:06 +01:00
Pavel Yaskevich
99d810aa7d [stdlib] Temporarily bring back Task.startSynchronously as deprecated 2025-05-09 23:59:36 -07:00
Pavel Yaskevich
001eab867d [stdlib] SE-0472: Rename Task and*TaskGroup APIs to match the proposal
`Task.startSynchronously` -> `Task.immediate`
`*TaskGroup.startTaskSynchronously{UnlessCancelled}` -> `*TaskGroup.addImmediateTask{UnlessCancelled}`
2025-05-09 23:59:30 -07:00
Slava Pestov
10ca7f6614 Merge pull request #81299 from slavapestov/remote-mirrors-meet-packs
RemoteInspection: Support for parameter packs
2025-05-09 22:28:31 -04:00
Slava Pestov
70b413dc56 RemoteInspection: Support for parameter packs 2025-05-09 14:49:37 -04:00
Evan Wilde
1a546a9ccb [FreeBSD]: Optional observation pthread primitives
The pthread APIs on FreeBSD do not include nullability APIs so the
pthread mutex APIs are imported as pointers to optional values.
Other platforms include nullability APIs and import the pthread APIs as
pointers to the mutex. Splitting the locking primitive type based on the
OS.

Fixes: rdar://150880976
2025-05-09 10:08:35 -07:00
Daniil Kovalev
a5c727125e Fix compilation errors appearing due to missing <cstdint> include (#81233)
This patch resolves the issue by adding missing `<cstdint>` includes.
For SmallVector.h, such a change was already introduced in LLVM repository:
7e44305041

<!--
If this pull request is targeting a release branch, please fill out the
following form:

https://github.com/swiftlang/.github/blob/main/PULL_REQUEST_TEMPLATE/release.md?plain=1

Otherwise, replace this comment with a description of your changes and
rationale. Provide links to external references/discussions if
appropriate.
If this pull request resolves any GitHub issues, link them like so:

  Resolves <link to issue>, resolves <link to another issue>.

For more information about linking a pull request to an issue, see:

https://docs.github.com/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
-->

<!--
Before merging this pull request, you must run the Swift continuous
integration tests.
For information about triggering CI builds via @swift-ci, see:

https://github.com/apple/swift/blob/main/docs/ContinuousIntegration.md#swift-ci

Thank you for your contribution to Swift!
-->
2025-05-08 17:43:29 -07:00
Henrik G. Olsson
59d7d3160f [Swiftify] Emit @availability when expansions contain Span (#81320)
This prevents errors when compiling for older targets using a newer
compiler.

rdar://150740330
2025-05-08 16:13:24 -07:00
Alejandro Alonso
d26bde798e Start building the runtime demangle tree for extended existentials 2025-05-07 13:56:25 -07:00
Ben Troller
3123cb0407 Merge pull request #81311 from btroller/clean-up-obj-interop-templating-in-remote-mirror
[RemoteMirror] Clean up templating used by Remote Mirror's SwiftReflectionContext to handle ObjC interop being enabled/disabled in the target.
2025-05-07 12:34:11 -07:00
Nate Cook
e68069f891 [stdlib] Allow a default for optional interpolations (#80547)
This adds an `appendInterpolation` overload to
`DefaultStringInterpolation` that includes a parameter for providing a
default string when the value to interpolate is `nil`. This allows this
kind of usage:

```swift
let age: Int? = nil
print("Your age is \(age, default: "timeless")")
// Prints "Your age is timeless"
```

The change includes an additional fixit when optional values are
interpolated, with a suggestion to use this `default:` parameter.
2025-05-07 12:47:02 -05:00
Alastair Houghton
921d6d8d2c Merge pull request #81332 from al45tair/eng/PR-148899609
[Concurrency] Don't pass negative times to the Dispatch code.
2025-05-07 09:46:26 +01:00
Guillaume Lessard
d8c3942198 Merge pull request #81224 from glessard/override-lifetime-publicly
[stdlib] make `_overrideLifetime()` functions public
2025-05-06 19:56:11 -07:00
Guillaume Lessard
bc22bcd820 [stdlib] remove TODOs
These TODOs aren’t particularly actionable. What we really want is a way to define `_overrideLifetime()` in a not-unsafe way, and that will probably be a `Builtin` operation.
2025-05-06 15:19:32 -07:00
Eric Miotto
dd9adeb0bf Merge pull request #81241 from edymtt/edymtt/add-builtin-float-dep-for-libraries-depending-on-darwin
CMake: add explicit dependency to _Builtin_float to targets...
2025-05-06 09:09:09 -07:00
Michael Gottesman
b34e2d72fb Merge pull request #81306 from gottesmm/pr-b6ba1a771d90007a5ee6da3e4dc657bfef32b320
[swift-settings] Now that we aren't using it immediately, remove it from tree.
2025-05-06 08:21:23 -07:00
Alastair Houghton
69c965e15c [Concurrency] Don't pass negative times to the Dispatch code.
Dispatch uses unsigned times, and cannot cope with times before its
clock started.  As such, passing negative times from Swift through to
the C++ code results in large unsigned values, which then causes us to
wait forever.  This is undesirable.

rdar://148899609
2025-05-06 15:56:07 +01:00
Slava Pestov
cc8639b523 Merge pull request #81301 from slavapestov/remote-mirrors-cleanups
RemoteInspection: Two small cleanups
2025-05-06 07:43:47 -04:00
Ben Troller
943c0a034a Clean up templating related to whether ObjC interop is enabled for a Remote Mirror context 2025-05-05 15:29:23 -07:00
Doug Gregor
d7c77130e7 Merge pull request #81293 from DougGregor/revert-hashable-asyncstream-inlining
Revert hashable asyncstream inlining
2025-05-05 15:14:34 -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
Slava Pestov
c205c802f6 RemoteInspection: Remove 'DidSubstitute' form of TypeRef::subst() 2025-05-05 14:59:45 -04:00
Slava Pestov
31947d0617 RemoteInspection: Fix latent bug in TypeRefIsConcrete::visitOpaqueArchetypeTypeRef() 2025-05-05 14:59:45 -04:00
Doug Gregor
f358c1e6b7 Revert "[Concurrency] Hashable funcs should be inlinable for AsyncStream"
This reverts commit 06bb7183f4.
2025-05-05 10:43:11 -07:00
Eric Miotto
8c7e8550aa CMake: add explicit dependency to _Builtin_float to targets...
... that would import that as a result of importing Darwin from the SDK.

Amend my previous change to Differentiation and Distributed in this
sense.

Addresses rdar://150400049
2025-05-05 10:39:14 -07:00
Doug Gregor
f04e916dff Fix issue with older compilers not handling MutableSpan code
The use of SendableCompletionHandlers here is completely incidental,
because it happened to be introduced at roughly the same time as the
bits we needed for MutableSpan. Fixes rdar://148072153.
2025-05-05 10:12:06 -07:00
Philippe Hausler
c4088252d0 [Concurrency] An implementation of system epochs for continuous and suspending clocks (#80409)
This implements
[SE-0473](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0473-clock-epochs.md)
2025-05-05 08:45:24 -07:00
Evan Wilde
91a0692bd1 Merge pull request #81227 from etcwilde/ewilde/FreeBSDPlatformExecutor
Add platform executor module for FreeBSD
2025-05-04 13:07:32 -07:00
Alastair Houghton
3b89d6d137 Merge pull request #81195 from al45tair/eng/PR-150290165
[Concurrency] Fix copy-paste error.
2025-05-04 18:33:50 +01:00