[cxx-interop] Allow retain/release operations to be methods

Some foreign reference types such as IUnknown define retain/release operations as methods of the type.

Previously Swift only supported retain/release operations as standalone functions.

The syntax for member functions would be `SWIFT_SHARED_REFERENCE(.doRetain, .doRelease)`.

rdar://160696723
(cherry picked from commit e78ce6165f)
This commit is contained in:
Egor Zhdan
2025-08-22 18:18:14 +01:00
parent 9016636714
commit c5c33d6c5a
11 changed files with 324 additions and 15 deletions

View File

@@ -265,6 +265,9 @@ ERROR(foreign_reference_types_release_non_void_return_type, none,
ERROR(foreign_reference_types_retain_release_not_a_function_decl, none,
"specified %select{retain|release}0 function '%1' is not a function",
(bool, StringRef))
ERROR(foreign_reference_types_retain_release_not_an_instance_function, none,
"specified %select{retain|release}0 function '%1' is a static function; expected an instance function",
(bool, StringRef))
ERROR(conforms_to_missing_dot, none,
"expected module name and protocol name separated by '.' in protocol "
"conformance; '%0' is invalid",