swift
eef47800 - [cxx-interop] Fix type-level ownership annotations for C++ APIs returning reference to frt (#84480)

Commit
3 days ago
[cxx-interop] Fix type-level ownership annotations for C++ APIs returning reference to frt (#84480) Type-level ownership annotations (`SWIFT_RETURNED_AS_UNRETAINED_BY_DEFAULT`) were not suppressing warning for C++ functions (which are not annotated with `SWIFT_RETURNS_(UN)RETAIND`) returning references (`&`) to foreign reference types. The annotation only worked for pointer returns (`*`), forcing developers to manually annotate every function returning a reference. This PR fixes this problem by changing the logic of `matchSwiftAttrOnRecordPtr` to consider `ReferenceType` also along with `PointerType`. This PR also adds comprehensive lit tests for ownership conventions and diagnostics related to C++ functions that return references to foreign reference types. These tests were previously not covered by our lit tests. rdar://161226212
Author
Parents
Loading