Skip to content

[Swiftify] Fix transformation sort, and dropped bounds checks #80317

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 2 commits into from
Mar 27, 2025

Conversation

hnrklssn
Copy link
Contributor

[Swiftify] Fix return value transformation being applied last

Casting the return value to Span must be done outside
withUnsafeBufferPointer, to prevent returning a ~Escapable type from a
function without lifetime info. To do this we sort the transformations
so that the return value transformation is performed last. There was
a bug in the comparison, so the sorting was not always done correctly.

rdar://147934170


[Swiftify] Don't drop bounds checks when mixing std::span and counted_by

When an imported function combines std::span and __counted_by,
std::span would override bounds checks emitted for __counted_by (if it
occurred later in the the parameter list) resulting in no bounds checks
being emitted.

rdar://147883384

@hnrklssn
Copy link
Contributor Author

@swift-ci please test

When an imported function combines std::span and __counted_by,
std::span would override bounds checks emitted for __counted_by (if it
occurred later in the the parameter list) resulting in no bounds checks
being emitted.

rdar://147883384
Casting the return value to Span must be done outside
withUnsafeBufferPointer, to prevent returning a ~Escapable type from a
function without lifetime info. To do this we sort the transformations
so that the return value transformation is performed last. There was
a bug in the comparison, so the sorting was not always done correctly.

rdar://147934170
@hnrklssn hnrklssn force-pushed the fix-sort-and-bounds-checks branch from d056383 to 160bb41 Compare March 26, 2025 20:49
@hnrklssn
Copy link
Contributor Author

@swift-ci please test

@hnrklssn
Copy link
Contributor Author

@swift-ci please smoke test

@hnrklssn hnrklssn enabled auto-merge March 26, 2025 21:01
@hnrklssn hnrklssn merged commit 0cc114f into main Mar 27, 2025
4 of 5 checks passed
@hnrklssn hnrklssn deleted the fix-sort-and-bounds-checks branch March 27, 2025 01:32
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