This replaces `strdup` with `_strdup` on Windows to avoid the POSIX API
deprecation warnings. It also does a minor simplification by removing
the superfluous `else`.
Fields containing metatypes with no possible subtypes are thin i.e. they have no storage. There is only one possible value they can have: the corresponding type. Mirror attempted to copy the nonexistent field value from the nonexistent storage, producing garbage. Instead, special-case thin metatypes and copy the instance type out of the metatype metadata rather than trying to copy it from the field.
rdar://108280543
type(of:) now returns the dynamic type of the contents of
an extended existential (just like it does for a regular existential)
Mirror can now reflect fields of a value stored inside an extended
existential (just like it can with a regular existential). This
requires type(of:) support, since Mirror internals use that to
determine how to reflect a value.
Resolves rdar://102906195
This replaces a number of `#include`-s like this:
```
#include "../../../stdlib/public/SwiftShims/Visibility.h"
```
with this:
```
#include "swift/shims/Visibility.h"
```
This is needed to allow SwiftCompilerSources to use C++ headers which include SwiftShims headers. Currently trying to do that results in errors:
```
swift/swift/include/swift/Demangling/../../../stdlib/public/SwiftShims/module.modulemap:1:8: error: redefinition of module 'SwiftShims'
module SwiftShims {
^
Builds.noindex/swift/swift/bootstrapping0/lib/swift/shims/module.modulemap:1:8: note: previously defined here
module SwiftShims {
^
```
This happens because the headers in both the source dir and the build dir refer to SwiftShims headers by relative path, and both the source root and the build root contain SwiftShims headers (which are equivalent, but since they are located in different dirs, Clang treats them as different modules).
* initial
* it works
demangling mostly works
fix dots
printing works
add tests
add conformance to AnyKeyPath
implement SPI
subscripts fully work
comments
use cross platform image inspection
remove unnecessary comment
fix
fix issues
add conditional conformance
add types
try to fix the api-digester test
cr feedback: move impls behind flag, remove addChain(), switch statement, fallthrough instead of if-elses, move import
cr feedback: refactor switch statement
fix #ifdef
reindent, cr feedback: removes manual memory management
fix missing whitespace
fix typo
fix indentation issues
switch to regexes
checks should test in on all platforms
print types in subscripts
add test for empty subscript
Update test/api-digester/stability-stdlib-abi-without-asserts.test
Co-authored-by: Xiaodi Wu <13952+xwu@users.noreply.github.com>
add commas
fix failing test
fix stdlib annotation
cr feedback: remove global, refactor ifdef
cr feedback: switch back to manual memory management
switch to 5.8 macro
add new weakly linked functions to the allowlist
fix one more failing test
more cr feedback
more cr feedback
* fix invisible unicode
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.