Skip to content

[cxx-interop] Add SWIFT_RETUNRS_(UN)RETAINED discussions to C++ interop docs #1077

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

fahadnayyar
Copy link

Documenting the usage of SWIFT_RETUNRS_(UN)RETAINED annotations to specify the ownership convention of the returned SWIFT_SHARED_REFERENCE types from C++ functions and methods

rdar://116817243

@fahadnayyar fahadnayyar marked this pull request as ready for review June 10, 2025 13:58
@fahadnayyar fahadnayyar force-pushed the cxx-frt-returns-unretained-docs branch from 3d5f9dd to 08c62b4 Compare June 11, 2025 04:28
Copy link
Contributor

@Xazax-hun Xazax-hun left a comment

Choose a reason for hiding this comment

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

I had some comments inline. cc @egorzhdan just in case he also wants to take a look.

@fahadnayyar
Copy link
Author

CC: @j-hui can you also please take a look?

@fahadnayyar
Copy link
Author

CC: @ravikandhadai

Copy link
Contributor

@j-hui j-hui left a comment

Choose a reason for hiding this comment

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

Thanks for documenting these annotations! I left some suggestions for how you can paraphrase things to be a little clearer.


Note that the Swift compiler will automatically infer the ownership conventons for Swift functions returning `SWIFT_SHARED_REFERENCE` types.
See [Exposing C++ Shared Reference Types back from Swift](#exposing-c-shared-reference-types-back-from-swift) for calling Swift functions returning `SWIFT_SHARED_REFERENCE` types from C++.

### Inheritance and Virtual Member Functions
Copy link
Author

Choose a reason for hiding this comment

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

TODO: ### -> ####

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.

4 participants