Skip to content

Conversation

hnrklssn
Copy link
Contributor

This adds support for attaching safe interop wrappers to functions explicitly imported as instance methods using swift_name.

rdar://156288883

@hnrklssn
Copy link
Contributor Author

@swift-ci please smoke test

This adds support for attaching safe interop wrappers to functions
explicitly imported as instance methods using swift_name.

rdar://156288883
@hnrklssn hnrklssn force-pushed the swiftify-import-as-method branch from 628fc8a to c1bf742 Compare September 25, 2025 05:45
@hnrklssn
Copy link
Contributor Author

@swift-ci please smoke test

1 similar comment
@hnrklssn
Copy link
Contributor Author

@swift-ci please smoke test

Copy link
Contributor

@Xazax-hun Xazax-hun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, left some small questions/nits inline.

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

While we handled prepending & to MutableSpan parameters, regular
parameters that were unchanged during the transformation were not
checked for inout-ness.
@hnrklssn
Copy link
Contributor Author

@swift-ci please smoke test

@hnrklssn
Copy link
Contributor Author

@swift-ci please smoke test

Since the compiler invokation performing the macro expansion dump
redirects its stderr output, any errors are not displayed by default.
This is extra problematic for test failures in CI. By performing the
compiler invokation with -verify first, errors are shown.
@hnrklssn
Copy link
Contributor Author

@swift-ci please smoke test

@hnrklssn
Copy link
Contributor Author

@swift-ci please smoke test

@hnrklssn
Copy link
Contributor Author

@swift-ci please smoke test

let args: [ExprSyntax] = base.signature.parameterClause.parameters.enumerated()
.map { (i: Int, param: FunctionParameterSyntax) in
return pointerArgs[i] ?? ExprSyntax("\(param.name)")
if let overrideArg = pointerArgs[i] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this is a fix we want to backport to 6.2.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's probably a good idea

@hnrklssn
Copy link
Contributor Author

@swift-ci please smoke test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants