swift
49df44fd - [cxx-interop][Runtime] Initialize metadata of a Swift array of C++ references correctly

Commit
1 year ago
[cxx-interop][Runtime] Initialize metadata of a Swift array of C++ references correctly This fixes a crash at runtime when destroying a Swift array of values of a C++ foreign reference type. Swift optimizes the amount of metadata emitted for `_ContiguousArrayStorage<Element>` by reusing `_ContiguousArrayStorage<AnyObject>` whenever possible (see `getContiguousArrayStorageType`). However, C++ foreign reference types are not `AnyObject`s, since they have custom retain/release operations. This change disables the `_ContiguousArrayStorage` metadata optimization for C++ reference types, which makes sure that `swift_arrayDestroy` will call the correct release operation for elements of `[MyCxxRefType]`. rdar://127154770 (cherry picked from commit fd04cc3a4e467ceb170517d377eef77d1b0922c0)
Author
Committer
Parents
Loading