Commit Graph

21803 Commits

Author SHA1 Message Date
eeckstein
830a842b7b Merge pull request #82455 from eeckstein/adress-of-borrow-feature
Guard InlineArray addressors with feature flag
2025-06-24 20:58:18 +02:00
Gabor Horvath
3dda301496 [cxx-interop] Reenable C++ benchmarks
The underlying issue was fixed in #82309

rdar://149402670
2025-06-24 17:57:42 +01:00
David Smith
08233afee9 Extend the existing memoization of NSString's Hashable conformance to cover AnyObjects that are actually NSStrings as well (#82440)
Fixes rdar://154123172 (Consider memoizing the lookup for NSString's
conformance to Hashable)
2025-06-24 08:21:13 -07:00
Erik Eckstein
0dbc63a00b Guard InlineArray addressors with feature flag
To be able to parse a recent Swift.swiftinterface file with a 6.2 compiler.
This is a follow-up fix for https://github.com/swiftlang/swift/pull/81441

rdar://154118968
2025-06-24 16:02:54 +02:00
Konrad `ktoso` Malawski
a28515ec7e Merge pull request #82372 from ktoso/wip-NeverErrorTaskShouldNotThrowInOperation 2025-06-24 15:35:43 +09:00
Guillaume Lessard
0473190189 [stdlib] adjust small string for contiguity 2025-06-23 18:38:33 -07:00
Guillaume Lessard
3aad241019 [stdlib] address 32-bit watchOS ABI issue 2025-06-23 18:31:16 -07:00
Adrian Prantl
31a9b798bb Merge pull request #82356 from adrian-prantl/catchall
[reflection] Fine-tune error messages
2025-06-23 15:13:10 -07:00
Alastair Houghton
0d14682f99 [Concurrency] Rename Dummy(Main|Task)Executor.
`UnimplementedExecutor` seems like a better name.

rdar://153531418
2025-06-23 16:47:50 +01:00
Allan Shortlidge
008efc432f stdlib: Fix missing unsafe operators in more places.
Add `unsafe` where it is still missing. I missed these in previous passes due
to conditional compilation.
2025-06-22 18:46:57 -07:00
3405691582
3bb369cd91 Use libpthread primitives for OpenBSD mutexes.
There has been some discussion as to whether this is the right approach,
centered around internal pointers in the underlying mutex structure.
After much thought, let's commit this for now. The argument:

* While it is true that OpenBSD has futex(2) and in fact is used in
  the underlying implementations in Dispatch. I'm not confident right now
  creating robust locking primitives by hand from futexes.
  It would be ideal to just delegate all of this to Dispatch, but
  Dispatch doesn't expose a ready-use API for mutexes. Cobbling one
  together might be possible, but that would take some time and finesse.

* While recent versions of C and C++ have language support for mutexes,
  they are implemented in many cases by libpthread anyway, so there
  is nothing inherently gained right now by not using the pthread API
  other than portability.

* While the concern for internal pointers for the pthread API is
  important, the OpenBSD is mitigated by the fact that pthread_mutex_t is
  pointer-valued on the platform. The concern that this might not always
  be the case is mitigated by the fact that this commit does not attempt
  to use the pthread implementation as a catch-all for all platforms.

* The alternative is to use MutexUnavailable, but given Foundation has
  some dependencies on Mutex, this may cause problems elsewhere
  throughout the port.
2025-06-21 10:26:39 -04:00
Konrad 'ktoso' Malawski
57a6a9931a [Concurrency] Task.immediate returning Never error must not have throwing operation
rdar://153855920
2025-06-20 09:32:37 +09:00
Saleem Abdulrasool
157fdd3977 Merge pull request #82342 from compnerd/unsafe
stdlib: handle `unsafe` annotations in additional places
2025-06-19 11:10:14 -07:00
Egor Zhdan
e4fb2549b9 Merge pull request #82309 from swiftlang/egorzhdan/span-shared-cache
[cxx-interop] Make usages of Swift Span `@_alwaysEmitIntoClient` in the overlay
2025-06-19 16:46:07 +01:00
Saleem Abdulrasool
2ee8787712 Merge pull request #82343 from compnerd/ntapi
Platform: expose NTAPI
2025-06-18 23:09:01 -07:00
michael-yuji
cf2f7154a5 Merge pull request #77836 from michael-yuji/mchiu/freebsd
[FreeBSD] Adding FreeBSD support
2025-06-18 19:59:48 -07:00
Adrian Prantl
45198dc0ee [reflection] Fine-tune error messages 2025-06-18 16:29:39 -07:00
Adrian Prantl
edc7109989 Merge pull request #82244 from adrian-prantl/expected-lowering
[Reflection] Add lightweight error handling to ReflectionContext
2025-06-18 10:08:43 -07:00
Saleem Abdulrasool
e049493d77 Platform: expose NTAPI
The NTAPIs are sometimes required to access some system information. At
the very least, the types defined here are useful to expose.
2025-06-18 09:51:52 -07:00
Saleem Abdulrasool
c17e67e1a9 stdlib: handle unsafe annotations in additional places
This applies more annotations in the `INTERNAL_CHECKS_ENABLED` disabled
paths, Windows, 32-bit, and non-ObjC paths. Interestingly enough, there
are a couple of compiler intrinsics which are also uncovered.
2025-06-18 09:46:17 -07:00
(null)
bc870eff36 removed duplicated 2025-06-17 16:07:39 -04:00
(null)
aaf283258b Merge branch 'main' into mchiu/freebsd 2025-06-17 15:41:57 -04:00
(null)
cf041b126e address pltaform orders and other nits 2025-06-17 15:37:49 -04:00
(null)
d6811260a9 Merge commit '665515c781999a81094bbe4f8302a7cb1a6a6b39' into mchiu/freebsd 2025-06-17 15:12:23 -04:00
Guillaume Lessard
e29b425a6b Merge pull request #82277 from glessard/rdar153219174-UMBP-mutableSpan
[stdlib] add missing computed properties
2025-06-17 11:51:06 -07:00
Egor Zhdan
67e2024417 [cxx-interop] Make usages of Swift Span @_alwaysEmitIntoClient in the overlay
This fixes a regression where projects that use the C++ stdlib overlay stop building because of a linker error:
```
ld: Shared cache eligible dylib cannot link to ineligible dylib '@rpath/libswiftCompatibilitySpan.dylib'.
```

Usages of `Span<T>` would generally cause a type metadata accessor to be emitted for `Swift.Span`. This becomes a problem with backdeployment, since Span is partially defined in a compatibility binary.

This change adds `@_alwaysEmitIntoClient` to generic usages of `Span` to prevent the type metadata accessor from being emitted into `libswiftCxx.a`.

rdar://152192080
2025-06-17 19:42:14 +01:00
Valeriy Van
61ab279986 Fix doc comment in DropWhile.swift (#82290) 2025-06-17 10:38:02 -07:00
Adrian Prantl
868c9912aa [Reflection] Add lightweight error handling to ReflectionContext
Reflection metadata lookup failures are notoriously difficult to debug
because there is no error handling in TypeLowering outside of
compile-time #ifdef'd fprintf(stderr) calls. The nicest thing to do
would be to adopt llvm::Expected<> but TypeLowering is also included
in the standard library, which only has access to a tiny subset of the
LLVM Support library. This patch adds a place to store a pointer to
the first encountered error, which can then be converted to an
llvm::Error at the API level.
2025-06-17 09:47:11 -07:00
Egor Zhdan
f6e61728c5 Merge pull request #82161 from swiftlang/egorzhdan/template-param-nullability
[cxx-interop] Import nullability of templated function parameters correctly
2025-06-17 16:51:47 +01:00
Valeriy Van
d22a24744f Fix bug making ~0x1 mask in stdlib/toolchain/CompatibilityDynamicReplacements/DynamicReplaceable.cpp (#82264)
Solves #62665.
2025-06-17 09:03:16 -04:00
Guillaume Lessard
0433cd292c [stdlib] add UMBP.mutableSpan accessor 2025-06-16 22:28:21 -07:00
Guillaume Lessard
f952ca5988 [stdlib] add URMBP.mutableBytes accessor 2025-06-16 22:28:21 -07:00
Konrad `ktoso` Malawski
1ea746ec52 Merge branch 'main' into wip-deprecate-extractisolation 2025-06-16 11:37:19 +09:00
Mike Ash
ec6a042831 [Runtime] Remove redundant swift_auth_code_function, use existing swift_auth_code.
rdar://153169049
2025-06-13 18:46:23 -04:00
Egor Zhdan
607dd4a7d4 [cxx-interop] Import nullability of templated function parameters correctly
This teaches ClangImporter to respect the `_Nonnull`/`_Nullable` arguments on templated function parameters.

Previously Swift would only import a non-annotated function overload. Using an overload that has either  `_Nonnull` or `_Nullable` would result in a compiler error. The non-annotated overload would get imported with incorrect nullability: Swift would always assume non-null pointers, which was inconsistent with non-templated function parameters, which are mapped to implicitly unwrapped optionals.

With this change all three possible overloads are imported, and all of them get the correct nullability in Swift.

rdar://151939344
2025-06-13 18:15:52 +01:00
Konrad 'ktoso' Malawski
c00946189c [Concurrency] Deprecate extractIsolation 2025-06-13 11:47:37 +09:00
Alastair Houghton
7a359a5e09 Merge pull request #82202 from al45tair/eng/PR-153152063
[Concurrency] Fix null pointer dereference for task-to-thread model.
2025-06-12 18:32:08 +01:00
Stephen Canon
c24bae70e8 Fixup Observations availability from 9999 to 6.2 (#82198) 2025-06-12 09:10:24 -04:00
Guillaume Lessard
3b9ec94f20 Merge pull request #82102 from valeriyvan/span
Fix parameter, doc comments in Span family
2025-06-12 04:41:50 -07:00
Alastair Houghton
69a2011f4f [Concurrency] Fix null pointer dereference for task-to-thread model.
In task-to-thread concurrency mode, `_getMainExecutorAsSerialExecutor`
returns `SerialExecutorRef::generic()`, which is, give or take, NULL.
Unfortunately we'd declared it as returning `any SerialExecutor`,
rather than `(any SerialExecutor)?`, and then the `getMainExecutor()`
function was calling `asUnownedSerialExecutor()` on it, which then
crashes.

rdar://153152063
2025-06-12 11:36:16 +01:00
Dan Blackwell
665515c781 Merge pull request #82158 from swiftlang/tsan-release-fix
[concurrency] Move tsan_release to point before task gets destroyed
2025-06-12 08:26:49 +01:00
Konrad `ktoso` Malawski
01f911a36b Merge pull request #82179 from ktoso/wip-fix-incorrect-memory-effects-on-task-create 2025-06-12 13:42:32 +09:00
Allan Shortlidge
71eede247f StdlibUnittest: Use @_lifetime instead of @lifetime.
Resolves a warning.
2025-06-11 12:49:43 -07:00
Joe Groff
b3273f700c Merge branch 'main' into rhombicuboctahedron 2025-06-11 06:40:58 -07:00
Konrad 'ktoso' Malawski
3aa28b4de9 [Concurrency] Correct memory effect attributes of task_create
Without this, llvm would sometimes wrongly assume there's no indirect
accesses and the optimizations can lead to a runtime crash, by
optimizing away initializing options properly.

Resolves rdar://152548190
2025-06-11 22:03:52 +09:00
Susana Monteiro
6164af2f46 Merge pull request #81832 from swiftlang/susmonteiro/class-metadata-private-fields
[cxx-interop] Support for printing C++ foreign references
2025-06-11 11:58:45 +01:00
Philippe Hausler
af76f1440c Convert DispatchGlobalExecutor deadline casts to a decltype based cast (which should hold on all platforms) 2025-06-10 22:11:05 -07:00
Mohamed Hegazy
43b49dd6a4 Add explicit cast to non-apple platforms 2025-06-10 19:01:32 -07:00
Saleem Abdulrasool
9f5c090206 Merge pull request #82125 from Steelskin/fabrice/symlink-clang-headers-static-dep
build: Ensure static headers are always symlinked
2025-06-10 12:46:21 -07:00
Saleem Abdulrasool
897fd5a56d Merge pull request #82126 from Steelskin/fabrice/stdlib-add-vcruntime-dep
modulemap: Add missing dependency on vcruntime
2025-06-10 12:41:41 -07:00