Commit Graph

7802 Commits

Author SHA1 Message Date
Guillaume Lessard
5b3647270b [stdlib] add RawSpan 2024-10-18 22:57:43 -07:00
Guillaume Lessard
5e819aeea6 [stdlib] generalize isPOD() over suppressible protocols 2024-10-18 22:57:43 -07:00
David Smith
bed89567d4 Disable calling _swift_stdlib_dyld_is_objc_constant_string, it's unnecessary currently (#77064) 2024-10-17 19:01:08 -07:00
Kuba (Brecka) Mracek
44bea0552a Merge pull request #76029 from kubamracek/embedded-traps-unique
[embedded] Make assert helper functions always inlined to avoid trap basic blocks from merging
2024-10-16 22:46:39 -07:00
Nate Cook
9265743adc Add validation to CollectionDifference decoder (#76876)
The `CollectionDifference` type has a few different invariants
that were not being validated when initializing using the type's
`Decodable` conformance, since the type was using the
autogenerated `Codable` implementation. This change provides
manual implementations of the `Encodable` and `Decodable`
requirements, and adds tests that validate the failure when trying
to decode invalid JSON for CollectionDifference (and a few other
types).
2024-10-11 17:23:55 -07:00
David Smith
bca125c760 rdar://137709108 (Mitigate the code size increase from eager-lazy array bridging by marking some methods release none) (#76966) 2024-10-10 23:29:25 -07:00
Karoy Lorentey
29cf262ef7 [stdlib] String.Index: conform to CustomDebugStringConvertible instead
Apply the LSG’s modifications as detailed in their review notes.
2024-10-07 17:00:13 -07:00
Karoy Lorentey
28ed16b469 [stdlib] String.Index.description: Explicitly note that the returned format is not stable
This tends to be generally through for most `description` properties, but explicitly calling it out should help preventing people from trying to parse the result in this case.
2024-10-07 16:02:18 -07:00
Karoy Lorentey
e39613b851 [stdlib] String.Index.description: Use @_aeic for now 2024-10-07 16:02:18 -07:00
Karoy Lorentey
01792372a9 [stdlib] String.Index: conform to CustomStringConvertible
This better exposes the internals of string indices, demystifying their operation and radically simplifying working with them.
2024-10-07 16:02:16 -07:00
Konrad `ktoso` Malawski
dea3b59331 Merge pull request #76250 from ktoso/wip-experimental-isolated-deinit 2024-10-03 17:19:10 +09:00
Egor Zhdan
7f597c63ae Merge pull request #76726 from swiftlang/egorzhdan/char8_t
[cxx-interop] Support `char8_t` C++20 type
2024-10-02 16:10:17 +01:00
Doug Gregor
af49172b55 Mark Range.init(uncheckedBounds:) and ClosedRange.init(uncheckedBounds:) as @unsafe 2024-09-30 15:20:36 -07:00
Konrad `ktoso` Malawski
45b97f146b Merge branch 'main' into wip-experimental-isolated-deinit 2024-09-30 13:47:39 +09:00
Amritpan Kaur
6066418340 Merge pull request #73242 from amritpan/metatype-kp-implementation 2024-09-28 02:46:15 -07:00
Philippe Hausler
4f53f189e0 [Embedded] Enable RangeSet for embedded targets (#76614) 2024-09-27 09:20:11 -07:00
Egor Zhdan
fcb590690e [cxx-interop] Support char8_t C++20 type
https://en.cppreference.com/w/cpp/keyword/char8_t

This is based on a patch from Varun Gandhi: https://github.com/swiftlang/swift/pull/26153

rdar://39988329 / resolves https://github.com/swiftlang/swift/issues/68726
2024-09-27 13:56:03 +01:00
Amritpan Kaur
1c494c4d89 [StdLib] Handle nil property descriptors. 2024-09-25 12:54:52 -07:00
Kuba (Brecka) Mracek
d3c5149714 Merge pull request #76658 from kubamracek/embedded-managed-buffer
[embedded] Add support for ManagedBuffer to Embedded Swift
2024-09-25 02:54:55 -07:00
Kuba Mracek
0b50c2155e Don't emit upcast to the same type in SimplifyAllocRefDynamic, add test, add comment 2024-09-24 08:48:51 -07:00
Kuba Mracek
c7a5569c4f [embedded] Add support for ManagedBuffer to Embedded Swift
This makes ManagedBuffer available and usable in Embedded Swift, by:

- Removing an internal consistency check from ManagedBuffer that relies on metatypes.
- Making the .create() API transparent (to hoist the metatype to the callee).
- Adding a AllocRefDynamicInst simplification to convert `alloc_ref_dynamic` to `alloc_ref`, which removes a metatype use.
- Adding tests for the above.
2024-09-23 13:32:50 -07:00
Konrad `ktoso` Malawski
b9319d80f1 Merge branch 'main' into wip-experimental-isolated-deinit 2024-09-23 09:01:06 +09:00
Meghana Gupta
961e6ea104 Merge pull request #76294 from meg-gupta/rewritenext
Rewrite UnsafeRawBufferPointer.Iterator.next
2024-09-20 12:10:39 -07:00
Konrad `ktoso` Malawski
d89347bed0 Merge branch 'main' into wip-experimental-isolated-deinit 2024-09-20 18:34:45 +09:00
Guillaume Lessard
a35dea18c5 [gardening] remove obsolete annotations 2024-09-19 12:56:31 -07:00
Konrad `ktoso` Malawski
7d1ce789ad Revert "Revert "Isolated synchronous deinit"" 2024-09-17 17:35:38 +09:00
Kuba (Brecka) Mracek
142df19324 Merge pull request #76231 from kubamracek/embedded-deinit-release
[embedded] Handle retain/retain ops inside deinit in Embedded Swift's swift_release
2024-09-16 16:13:08 -07:00
Stephen Canon
a4c20e043b Add borrowing _withUnprotectedUnsafePointer (#76446)
* Add non-inout `_withUnprotectedUnsafePointer`

For withUnsafePointer we have both an inout and a borrowing form, allowing it to be used with immutable values. Add a parallel form for the unprotected variant.

* Update LifetimeManager.swift
2024-09-16 14:11:34 -04:00
Kuba Mracek
b4431db2c5 [embedded] Add a more detailed explaining comment to swift_release_n_ 2024-09-16 10:37:40 -07:00
Jonathan Grynspan
db7a030a71 Extend internal _mangledTypeName() function to take non-copyable types. (#76041)
`_mangledTypeName()` returns the Swift-mangled typename of a given type. This PR extends it to take non-copyable types as well.

Related to our use case in Swift Testing, but not to the PR directly: #69146 #69147 #71112

Resolves rdar://134278607.
2024-09-11 16:11:58 -04:00
Mike Ash
3937ceecc7 [Stdlib] Mark CVaListPointer as @unsafe.
rdar://135604375
2024-09-10 14:49:38 -04:00
Meghana Gupta
2f37e10674 Rewrite UnsafeRawBufferPointer.Iterator.next to avoid non natural loop in SIL
The current implementation creates a non-natural loop and none of the SIL and
LLVM loop passes will work for such loops. We have to find a way to fix this in
SIL. Until then, rewrite so we get a natural loop in SIL.
2024-09-05 15:35:39 -07:00
Alex Hoppen
c5aa49ba64 Revert "Isolated synchronous deinit" 2024-09-03 18:11:26 -07:00
Kuba Mracek
249f7e6073 [embedded] Handle retain/retain ops inside deinit in Embedded Swift's swift_release 2024-09-03 14:38:03 -07:00
Konrad `ktoso` Malawski
c86e4a8738 Merge pull request #60057 from nickolas-pohilets/mpokhylets/isolated-deinit
Co-authored-by: Konrad `ktoso` Malawski <ktoso@apple.com>
2024-09-04 01:16:56 +09:00
Alejandro Alonso
027a95a1b5 Merge pull request #76097 from jeongHunE/main
[stdlib] Fix the indentation from 1 space to 2 spaces in ArraySlice.s…
2024-09-02 21:22:55 -07:00
Konrad `ktoso` Malawski
c55ad6fa88 Merge branch 'main' into mpokhylets/isolated-deinit 2024-09-02 23:16:17 +09:00
Allan Shortlidge
5c30b30947 Merge pull request #76177 from tshortli/availability-visionos
build-script: Copy `libclang_rt.a` from the host toolchain for visionOS
2024-08-31 10:00:13 -07:00
Allan Shortlidge
48f236d09a build-script: Copy libclang_rt.a from the host toolchain for visionOS.
During the toolchain build, when building the Swift standard library for
platforms other than macOS the `libclang_rt.a` needs to be copied out of the
host SDK. That wasn't happening for visionOS.

Resolves rdar://135023111.
2024-08-30 18:15:13 -07:00
Alejandro Alonso
10314365e4 Merge pull request #76144 from Benedicto-H/fix-Dictionary-doc
[stdlib] Fix typos in Dictionary.swift
2024-08-29 21:48:03 -07:00
Benedicto Hong
5b30f78b53 [stdlib] Fix typos in Dictionary.swift
Hi, I fixed several typos in Dictionary.swift file(#Line: 347, 1194).

- origin comments
```swift
// #347
// Prints "The 'star' image is a glyph.")

// #1194
// Prints "No value found for that key.""
```

- changed comments
```swift
// #347
// Prints "The 'star' image is a glyph.")  // I thought the ' ) ' character was unnecessary, so I removed it.

// #1194
// Prints "No value found for that key.""  // I thought the ' " ' character was unnecessary, so I removed it.
```
2024-08-29 20:31:59 +09:00
Mykola Pokhylets
e0ad7bde82 Merge branch 'main' into mpokhylets/isolated-deinit
# Conflicts:
#	include/swift/Basic/Features.def
#	lib/AST/ASTPrinter.cpp
#	lib/AST/FeatureSet.cpp
2024-08-29 11:28:43 +02:00
Allan Shortlidge
51143aa8ea stdlib: Upstream _stdlib_isOSVersionAtLeast_AEIC().
In the standard library shipped in Apple's SDKs and OSes, the implementation of
`_stdlib_isOSVersionAtLeast()` has diverged in order to solve some tricky
issues related to supporting iOS applications running on macOS. It's now time
to bring that change upstream in order to unblock further changes that depend
on it.

Originally introduced to resolve rdar://83378814.
2024-08-28 22:07:59 -07:00
정훈
193a3063dc [stdlib] Fix the indentation from 1 space to 2 spaces in ArraySlice.swift 2024-08-27 09:01:54 +09:00
Changhyun-Kyle
1b97c574a4 [stdlib] Fix typo in Collection.swift 2024-08-26 18:53:05 +09:00
Kuba Mracek
555ca3bcec [embedded] Make assert helper functions always inlined to avoid trap basic blocks from merging 2024-08-21 15:03:46 -07:00
Mykola Pokhylets
0412597731 Added swift_retainCount to EmbeddedRuntime.swift
Fixes test/embedded/concurrency-actors.swift
2024-08-19 23:41:33 +02:00
Doug Gregor
8378562e12 Adopt @unsafe throughout the standard library
Annotate all of the `Unsafe*` types and `unsafe` functions in the standard
library (including concurrency, synchronization, etc.) as `@unsafe`. Add a
few tests to ensure that we detect uses of these types in clients that
have disabled unsafe code.
2024-08-19 14:33:09 -07:00
Doug Gregor
f8d483da0e Restore comment accidentally removed in typed throws adoption 2024-08-16 14:10:08 -07:00
Doug Gregor
8760b7caad Consistently use @usableFromInline and remove redundant @inlinables 2024-08-16 13:03:07 -07:00