Skip to content

[6.2] SILGen: Handle struct fields and addressors as addressable storage. #82296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

jckarter
Copy link
Contributor

@jckarter jckarter commented Jun 17, 2025

Explanation: Applies the addressability logic to stored properties of addressable structs, as well as computed properties that are implemented using the unsafeAddress/unsafeMutableAddress addressor accessors. This is necessary for, among other things, C++ interop, where it is expected that projecting shared_ptr and other imported pointer/reference types does not copy a temporary, and where functions may produce ad-hoc references without formal dependencies.

Scope: Fills in missing functionality in the @_addressable feature.

Issue: rdar://152280207

Original PR: #82288

Risk: Low. This should not affect most existing code, only affecting code that uses new C++ interop or ~Escapable type features.

Testing: Swift CI, test cases from bug report

Reviewer: @atrick

When accessing stored properties out of an addressable variable or parameter
binding, the stored property's address inside the addressable storage of the
aggregate is itself addressable. Also, if a computed property is implemented
using an addressor, treat that as a sign that the returned address should be
used as addressable storage as well. rdar://152280207
@jckarter jckarter requested a review from a team as a code owner June 17, 2025 15:08
@jckarter
Copy link
Contributor Author

@swift-ci Please test

@jckarter
Copy link
Contributor Author

@swift-ci Please test macOS

@atrick
Copy link
Contributor

atrick commented Jun 17, 2025

LGTM

@jckarter jckarter merged commit c224505 into swiftlang:release/6.2 Jun 18, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants