[cxx-interop] Allow retain/release operations to return an unsigned integer

Release/retain functions for C++ foreign reference types might return a reference count as an integer value.

Swift previously emitted an error for such functions, saying that the retain/release functions need to return void or a reference to the value.

rdar://157853183

(cherry picked from commit 3887ed0637)
This commit is contained in:
Egor Zhdan
2025-08-15 14:17:10 +01:00
parent e7deaebacd
commit 44429648ea
5 changed files with 46 additions and 9 deletions

View File

@@ -256,11 +256,11 @@ ERROR(foreign_reference_types_invalid_retain_release, none,
ERROR(foreign_reference_types_retain_non_void_or_self_return_type, none,
"specified retain function '%0' is invalid; "
"retain function must have 'void' or parameter return type",
"retain function must either return have 'void', the reference count as an integer, or the parameter type",
(StringRef))
ERROR(foreign_reference_types_release_non_void_return_type, none,
"specified release function '%0' is invalid; "
"release function must have 'void' return type",
"release function must either return 'void' or the reference count as an integer",
(StringRef))
ERROR(foreign_reference_types_retain_release_not_a_function_decl, none,
"specified %select{retain|release}0 function '%1' is not a function",