Commit Graph

26 Commits

Author SHA1 Message Date
Allan Shortlidge
dbd3d40c07 stdlib: Address StrictMemorySafety warnings in KeyPath related code. 2025-03-31 16:45:08 -07:00
Doug Gregor
22eecacc35 Adopt unsafe annotations throughout the standard library 2025-02-26 14:28:01 -08:00
Alejandro Alonso
6fdb684fd2 Optimization for single component and fix tests 2025-02-04 15:16:39 -08:00
Alejandro Alonso
f9f640b141 Sendablize the standard library
oops dont add this flag

no more nonisolated
2024-03-05 15:02:09 -08:00
Guillaume Lessard
0c916f507d [stdlib] replace uses of String(validatingUTF8:)
- use the new name `String(validatingCString:)`
2023-09-11 14:17:05 -07:00
Mike Ash
a6bab7332d [Reflection] Handle -disable-reflection-names in _forEachField.
Invoke our callback with an empty name string when reflection names are disabled, rather than throwing a fatal error.

rdar://108709009
2023-05-03 08:55:28 -04:00
Joe Groff
4ea98f92d2 Merge pull request #39119 from kateinoigakukun/katei/fix-internal-cc-mismatch
[stdlib] Fix cc mismatch violation on swift_isClassType
2022-08-18 10:00:01 -07:00
Saagar Jha
bb499b2dcf [stdlib] Fix comment on _forEachFieldWithKeyPath
The description for the body block appears to have been copied from
_forEachField without modification, even though the type signature
differs.
2022-02-19 00:59:47 -08:00
Karoy Lorentey
8ed81ae063 [stdlib] Adopt availability macros 2021-10-31 15:00:58 -07:00
Kuba (Brecka) Mracek
404badb49a Introduce SWIFT_ENABLE_REFLECTION to turn on/off the support for Mirrors and reflection (#33617) 2021-09-08 13:08:13 -07:00
Yuta Saito
9b13d1f8bb [stdlib] Fix cc mismatch violation on swift_isClassType
_isClassType is mainly called by compiler-generated code, but it's also
called by stdlib. The call-site of stdlib used @_silgen_name to link the
function, so it's called through swiftcc. However its cc is defined as
C-cc, so caller and callee used different cc.
This patch adds C-compatible decl of swift_isClassType in shims so that
it can be called by stdlib with C-cc.
This change doesn't break ABI because `_isClassType` in stdlib was
defined as internal API.
2021-09-05 02:38:32 +00:00
Mishal Shah
23c3b15f5f Support Xcode 13 beta
* Updating availability versions
* Remove all remaining overlays in stdlib/public/Darwin/*:
   - ObjectiveC
   - Dispatch
   - CoreFoundation
   - CoreGraphics
   - Foundation
2021-06-07 12:04:31 -07:00
Ben Cohen
125902923c Revert lazy mirror children (#36722) 2021-04-08 16:34:50 -10:00
Parker Schuh
4e39e59a8a Add a field reflection function that constructs keypaths. (#34815)
While the existing _forEachField in ReflectionMirror.swift
already gives the offsets and types for each field, this isn't
enough information to construct a keypath for that field in
order to modify it.

For reference, this should be sufficent to implement the features
described here: (https://forums.swift.org/t/storedpropertyiterable/19218/62)
purely at runtime without any derived conformances for many types.

Note: Since there isn't enough reflection information for
`.mutatingGetSet` fields, this means that we're not able to support
reflecting certain types of fields (functions, nonfinal class fields,
etc). Whether this is an error or not is controlled by the `.ignoreUnknown`
option.
2020-11-30 09:17:23 -08:00
Nate Cook
3af1deb447 [stdlib] Add _forEachField(of:options:body:) function (#32873)
This function walks all the fields of a struct, class, or tuple, and calls
`body` with the name, offset, and type of each field. `body` can perform
any required work or validation, returning `true` to continue walking fields
or `false` to stop immediately.
2020-07-14 16:31:32 -05:00
Ben Cohen
5ec1e3ed7b Refactor Mirror to reduce metadata allocation (#32041)
- Refactor Mirror.descendents

- Add _Either sequence

- Create custom reflected children type

- Switch Mirror to use _Either
2020-05-28 10:51:57 -07:00
David Smith
1efa946caf Remove stdlib and runtime dependencies on Foundation and CF 2019-09-12 18:03:14 -07:00
Arnold Schwaighofer
fe69a86929 Revert "Remove stdlib and runtime dependencies on Foundation and CF"
It is causing bots to fail.

* Revert "The __has_include(<os/system_version.h>) branch here wasn't quite right, we'll just use the dlsym one for now"

This reverts commit f824922456.

* Revert "Remove stdlib and runtime dependencies on Foundation and CF"

This reverts commit 3fe46e3f16.

rdar://54709269
2019-08-26 13:00:08 -07:00
David Smith
3fe46e3f16 Remove stdlib and runtime dependencies on Foundation and CF 2019-08-23 14:10:23 -07:00
Ben Cohen
a4230ab2ad [stdlib] Update stdlib to 4.0 and reorganize compatibility shims (#17580)
* Update stdlib to 4.0 and move all compatibility shims into a dedicated source file
2018-06-29 06:26:52 -07:00
Ben Cohen
92b6d8cb8f Remove inlineability from mirrors (#17476) 2018-06-25 19:54:13 -07:00
Karoy Lorentey
23c630ac92 [stdlib] Add @usableFromInline to internal typealiases that need it
This fixes 3659 warnings in the standard library.
2018-06-18 16:34:19 +01:00
Slava Pestov
2e5aef9c8d stdlib: Remove redundant @usableFromInline attributes 2018-04-06 00:02:30 -07:00
Slava Pestov
e1f50b2d36 SE-0193: Rename @_inlineable to @inlinable, @_versioned to @usableFromInline 2018-03-30 21:55:30 -07:00
Mike Ash
29eb740bf3 [Runtime] Style fixes in new ReflectionMirror code.
rdar://problem/20356017
2018-02-21 14:32:17 -05:00
Mike Ash
4045edf886 [Runtime] Remove old-style mirrors in ReflectionLegacy.swift.
The old-style mirrors were the basis for non-custom, reflection based Mirrors. As part of removing old-style mirrors, reflection based Mirrors are reimplemented without them. Reflection.mm is deleted and replaced with ReflectionMirror.mm, which borrows a chunk of the old code but presents a simpler API to the Swift side. ReflectionMirror.swift then uses that API to implement a reflection-based Mirror init.

rdar://problem/20356017
2018-02-16 16:05:40 -05:00