mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This patch improves the warning for C++ APIs returning `SWIFT_SHARED_REFERENCE` types but not annotated with either `SWIFT_RETURNS_RETAINED` or `SWIFT_RETURNS_UNRETAINED` in the following ways: 1. The warning for missing `SWIFT_RETURNS_(UN)RETAINED` annotations is now emitted on Swift use sites, rather than while importing the API (func/method decls). - This logic is now implemented as a Misl Diagnostic in function `diagnoseCxxFunctionCalls` in file lib/Sema/MiscDiagnostics.cpp. - The warning is now triggered only when the API is actually used, which reduces noise in large C++ headers. - These warnings are still gated behind experimental-feature-flag `WarnUnannotatedReturnOfCxxFrt` rdar://150800115