-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[cxx-interop] Warning unannotated C++ APIs returning SWIFT_SHARED_REFERENCE types #76798
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
[cxx-interop] Warning unannotated C++ APIs returning SWIFT_SHARED_REFERENCE types #76798
Conversation
@swift-ci please test |
@swift-ci please test |
1 similar comment
@swift-ci please test |
2bc6ed0
to
ca1094c
Compare
@swift-ci please test |
@swift-ci Please Build Toolchain |
@swift-ci please test |
@swift-ci Please Build Toolchain macOS |
ca1094c
to
92b7417
Compare
@swift-ci please test |
92b7417
to
ad4df73
Compare
@swift-ci please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good to me, some nits inline, and I think some of the TODOs should be resolved in this PR (not in a follow-up).
test/Interop/Cxx/foreign-reference/frt-retained-unretained-attributes-error.swift
Outdated
Show resolved
Hide resolved
ad4df73
to
e753bf6
Compare
e753bf6
to
e640ed6
Compare
@swift-ci please smoke test |
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once Egor is happy about the placement of the new utility functions, I think this should be good to go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have one question regarding C++ pointers vs references. Otherwise this change would look good to me.
@swift-ci please smoke test windows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR looks good to me, with the disclaimer that I don't yet have much experience or confidence navigating this codebase yet. I left a couple of nits related to naming conventions.
I thought of an edge case that might be out of the scope of this PR: how would Swift/Clang treat multiple function declarations with different annotations? e.g.,:
T *_Nonnull f();
T *_Nonnull f() __attribute__((swift_attr("returns_retained")));
T *_Nonnull f() __attribute__((swift_attr("returns_unretained")));
Are the attributes coalesced across the different declarations?
@swift-ci please smoke test windows |
Adding a warning when C++ APIs (functions or methods) returning C++ foreign reference types or SWIFT_SHARED_REFERENCE types are not annotated with either of SWIFT_RETURNS_RETAINED and SWIFT_RETURNS_UNRETAINED.
rdar://139225276