mirror of
https://github.com/apple/swift.git
synced 2026-06-20 15:42:51 +02:00
ad022559fc
Swift functions exposed to C++ return +1 (retained) values, but the generated C++ thunks in the -Swift.h header lacked ownership annotations. This prevented Clang's static analyzer from verifying reference counts when C++ code calls into Swift. Add NS_RETURNS_RETAINED, CF_RETURNS_RETAINED, and SWIFT_RETURNS_RETAINED annotations to thunk signatures based on the return type: - NS_RETURNS_RETAINED for ObjC classes (NSString, etc.) and existentials (id) - CF_RETURNS_RETAINED for CF types (CFString, etc.) - SWIFT_RETURNS_RETAINED for foreign reference types rdar://165231653