-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[C++-Interop] Import const &T
function parameters as @in_guaranteed
#61000
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
Conversation
@swift-ci please smoke test |
Not for this PR necessarily, but we are still missing the one in the allocator/initializer case 😞 |
8d8fac8
to
8bbf8f9
Compare
Added |
@@ -36,42 +36,34 @@ func testFunction() { | |||
|
|||
// RUN: %target-swift-frontend -c -enable-experimental-cxx-interop -enable-objc-interop -I %S/Inputs %s -emit-silgen -o - | %FileCheck %s | |||
|
|||
// COM: FIXME: should it be @in_guaranteed OptionsStruct? https://github.com/apple/swift/issues/60601 | |||
// CHECK: [[FN1:%[0-9]+]] = function_ref @$sSo19OptionsConsumerObjCC7optionsABSo0A6StructV_tcfC : $@convention(method) (OptionsStruct, @thick OptionsConsumerObjC.Type) -> @owned OptionsConsumerObjC |
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 one is the one that I was confused. IIUC $sSo19OptionsConsumerObjCC7optionsABSo0A6StructV_tcfC
demangles to __C.OptionsConsumerObjC.__allocating_init(options: __C.OptionsStruct) -> __C.OptionsConsumerObjC
which seems to be an Obj-C initializer, and it does not have @in
nor @in_guaranteed
. I don't know if this is required, or in this case it is fine to pass a copy.
But this one is different than in your new test, which shows a non-mangled name. I wonder if the designated initializer bit changes something.
8bbf8f9
to
25aa850
Compare
@swift-ci please smoke test |
25aa850
to
834fe9a
Compare
@swift-ci please smoke test |
@hyp Do these changes look ok to you? |
test/Interop/Cxx/reference/Inputs/reference-silgen-cxx-objc-ctors+init.h
Outdated
Show resolved
Hide resolved
test/Interop/Cxx/reference/Inputs/reference-silgen-cxx-objc-ctors+init.h
Outdated
Show resolved
Hide resolved
When passing value types as a const-ref to a C++ API, ensure that the caller is tasked with handling the lifetime of the instance passed in.
834fe9a
to
84a69c4
Compare
Addressed your comments @zoecarver |
@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.
LGTM
When passing value types as a const-ref to a C++ API, ensure that the caller is tasked with handling the lifetime of the instance passed in.
@hyp @zoecarver @drodriguez