Skip to content

[cxx-interop] Fix wrong calling convention for some C++ types #78544

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
Jan 14, 2025

Conversation

Xazax-hun
Copy link
Contributor

We erroneously used @autoreleased convention for C++ types in some scenarios.

We erroneously used @autoreleased convention for C++ types in some
scenarios.
@Xazax-hun Xazax-hun added the c++ interop Feature: Interoperability with C++ label Jan 10, 2025
@Xazax-hun Xazax-hun requested a review from rjmccall January 10, 2025 12:45
@Xazax-hun
Copy link
Contributor Author

@swift-ci please test

Copy link
Contributor

@egorzhdan egorzhdan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@rjmccall rjmccall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, autoreleased is clearly wrong, so approved, I guess, but how confident are we that these pointers are actually being returned at +1?

@Xazax-hun Xazax-hun merged commit 4ae5685 into main Jan 14, 2025
5 checks passed
@Xazax-hun Xazax-hun deleted the gaborh/calling-conv branch January 14, 2025 10:12
@Xazax-hun
Copy link
Contributor Author

approved

Thanks! If anything falls out in the follow-up discussion I will address it in a follow-up PR.

how confident are we that these pointers are actually being returned at +1

This was the weirdest part, I hit this with value types as well and eventually it even triggered some crashes. We have special handling for foreign references in place, so I hope this code path would be triggered by value types.

Xazax-hun added a commit that referenced this pull request Jan 14, 2025
[cxx-interop] Fix wrong calling convention for some C++ types
@rjmccall
Copy link
Contributor

Alright. Values returned by C++ are definitely returned at +1, so that would work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ interop Feature: Interoperability with C++
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants