Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SILGen] Fix a bug where the wrong convention was being used for computing the type of a closure thunk #73299

Merged
merged 3 commits into from Apr 30, 2024

Conversation

ahatanaka
Copy link
Contributor

The ObjC selector family convention was being used instead of the C function type convention.

rdar://127090209

computing the type of a closure thunk

The ObjC selector family convention was being used instead of the C
function type convention.

rdar://127090209
@ahatanaka
Copy link
Contributor Author

@swift-ci please test

@ahatanaka
Copy link
Contributor Author

@swift-ci please test

@@ -4109,6 +4109,19 @@ static CanSILFunctionType getUncachedSILFunctionTypeForConstant(
}
}

// The type of the native-to-foreign thunk for a swift closure.
if (shouldStoreClangType(TC.getDeclRefRepresentation(constant)) &&
constant.isForeign && constant.hasClosureExpr()) {
Copy link
Member

Choose a reason for hiding this comment

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

Could you check the foreign + closure conditions first? They seem like they'll weed things out a lot more than the shouldStoreClangType condition, which I guess is just future-proofing against other kinds of foreign reference.

Copy link
Member

@rjmccall rjmccall left a comment

Choose a reason for hiding this comment

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

LGTM

@ahatanaka ahatanaka enabled auto-merge (squash) April 29, 2024 19:34
@ahatanaka ahatanaka disabled auto-merge April 29, 2024 19:34
@ahatanaka
Copy link
Contributor Author

@swift-ci please test

@ahatanaka ahatanaka enabled auto-merge (squash) April 29, 2024 19:36
@ahatanaka ahatanaka merged commit 428fe21 into main Apr 30, 2024
4 of 5 checks passed
@ahatanaka ahatanaka deleted the closure-to-cxx-function-pointer-direct branch April 30, 2024 01:04
ahatanaka added a commit that referenced this pull request Apr 30, 2024
…uting the type of a closure thunk (#73299)

The ObjC selector family convention was being used instead of the C
function type convention.

rdar://127090209
(cherry picked from commit 428fe21)
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.

None yet

2 participants