Skip to content

Emit inline Swift wrappers for C functions when --no-wrapper-methods is set. - #2829

Open
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_960494238
Open

Emit inline Swift wrappers for C functions when --no-wrapper-methods is set.#2829
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_960494238

Conversation

@copybara-service

Copy link
Copy Markdown

Emit inline Swift wrappers for C functions when --no-wrapper-methods is set.

When --no-wrapper-methods is enabled in a @SwiftName context, C functions previously received an NS_SWIFT_NAME attribute directly on their FOUNDATION_EXPORT declaration. This caused Clang to emit 'obsoleted in Swift 3' availability warnings when Swift clients attempted to invoke the C functions directly.
This change keeps FOUNDATION_EXPORT C function declarations unannotated and generates an inline wrapper function (NS_INLINE ..._swiftName(...) NS_SWIFT_NAME(...)) forwarding calls to the C function. This allows Swift clients to call either the C function directly or use the Swift name wrapper.

…is set.

When --no-wrapper-methods is enabled in a `@SwiftName` context, C functions previously received an `NS_SWIFT_NAME` attribute directly on their `FOUNDATION_EXPORT` declaration. This caused Clang to emit 'obsoleted in Swift 3' availability warnings when Swift clients attempted to invoke the C functions directly.
This change keeps `FOUNDATION_EXPORT` C function declarations unannotated and generates an inline wrapper function (`NS_INLINE ..._swiftName(...) NS_SWIFT_NAME(...)`) forwarding calls to the C function. This allows Swift clients to call either the C function directly or use the Swift name wrapper.

PiperOrigin-RevId: 960494238
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant