Skip to content

Cherry-pick "[Swiftify] Support __sized_by on byte-sized pointee types" to release/6.2 #82145

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

Merged
merged 1 commit into from
Jun 11, 2025

Conversation

hnrklssn
Copy link
Contributor

  • Explanation:
    This adds support for producing safe overloads for pointers annotated with __sized_by when the pointer is imported as Unsafe[Mutable]Pointer. Previously __sized_by was only supported for Unsafe[Mutable]RawPointer and OpaquePointer. ClangImporter is modified to check the pointee type for __sized_by, and only apply this if the pointee type has a size of 1 byte. If the pointee type is larger, __counted_by is the preferred annotation.
  • Scope:
    This fixes errors that would otherwise be produced when using __sized_by in a way not supported by _SwiftifyImport, even though that use case was supported by clang. In cases that still aren't supported, we no longer produce an overload.
  • Issues:
    rdar://150966684
    rdar://150966021
  • Original PRs:
    [Swiftify] Support __sized_by on byte-sized pointee types #81752
  • Risk:
    Low
  • Testing:
    Added regression tests, will continue with manual qualification
  • Reviewers:
    @delcypher
    @Xazax-hun

@hnrklssn hnrklssn requested a review from DougGregor June 10, 2025 14:19
@hnrklssn hnrklssn requested a review from a team as a code owner June 10, 2025 14:19
@hnrklssn
Copy link
Contributor Author

@swift-ci please test

[Swiftify] Support __sized_by on byte-sized pointee types

(cherry picked from commit 89b09a6)
@hnrklssn hnrklssn force-pushed the swiftify-sizedby-6.2 branch from 46ad99f to 993929c Compare June 10, 2025 19:50
@hnrklssn
Copy link
Contributor Author

@swift-ci please test

@hnrklssn hnrklssn enabled auto-merge June 10, 2025 19:51
@hnrklssn hnrklssn merged commit 6e6a57b into swiftlang:release/6.2 Jun 11, 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