swift icon indicating copy to clipboard operation
swift copied to clipboard

[cxx-interop] convert CXXForeignReferenceTypeInitializers into SuppressCXXForeignReferenceTypeInitializers to be an opt-out flag

Open fahadnayyar opened this issue 9 months ago • 3 comments

First steps towards turning ctor of C++ foreign reference types to be callable as Swift Initializers on by default.

rdar://148285972

fahadnayyar avatar Apr 08 '25 23:04 fahadnayyar

@swift-ci please smoke test

fahadnayyar avatar Apr 10 '25 02:04 fahadnayyar

NOTE: I am addressing rdar://145098078 as well in this patch. SWIFT_RETURNS_(UN)RETAINED related diagnostics (specially the warning in case of unannotated C++ APIs returning SWIFT_SHARED_REFERENCE types) were not triggering for cases where the return type in the C++ API is not annotated with SWIFT_SHARED_REFERENCE directly but it derives the reference semantics from one of its parent type via C++ inheritance.

We still need to address rdar://148952864 which is a minor bug. Now we also see diagnostics for C++ APIs returning a type which was derived from a SWIFT_IMMORTAL_REFERNECE. The diagnostic does not trigger when return type is SWIFT_IMMORTAL_REFERNECE but only when IMMORTAL_REFERNECE behaviour is inferred from a base type via C++ inheritance.

fahadnayyar avatar Apr 10 '25 04:04 fahadnayyar