mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
**Explanation**: In Swift 6.1, we introduced warnings for C++ APIs returning `SWIFT_SHARED_REFERENCE` types that lack the `SWIFT_RETURNS_(UN)RETAINED` annotations. These warnings serve as a reminder to annotate APIs, as the absence of these annotations can lead to arbitrary assumptions about the ownership of returned `SWIFT_SHARED_REFERENCE` values. This could result in both use-after-free (memory safety) bugs and memory leaks. We have received feedback from a few adopters indicating potential false positive cases where these warnings are triggered. Consequently, we have decided to disable these warnings in Swift 6.2 and re-qualify the warnings on larger projects to ensure their effectiveness and eliminate false positives. - **Scope**: Disabling a previously shipped warning. There is no likelihood of any source breakage or semantic alterations. - **Issues**: rdar://150937617 , rdar://150800115 - **Original PRs**: N/A - **Risk**: Low - **Testing**: Lit test and adopted manually on a demo Xcode project - **Reviewers**: N/A Our intention is to re-enable the warnings in later beta releases of Swift 6.2 once we have stronger evidence of their effectiveness on large codebases and proof that there are no false positives.