-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Update function type mangling to use Clang type when applicable. #34057
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
Update function type mangling to use Clang type when applicable. #34057
Conversation
I grepped the macOS and iOS SDKs for |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's interesting to me that you decided that it was important to set this correctly up-front rather than determine it retroactively. Can you talk about what went into that decision?
Are you asking about the |
You're right, it's being mapped to CBool. There's only 1 place which is using this in the macOS SDK: RealityKit's swiftinterface. 🤦🏼
I think this is not going to be a problem though, since the class is not an |
I was talking about the "derivable from Swift type" bit, which I'm guessing this PR used to call "isCanonical". (Thank you for renaming it; that would have been a very confusing name.) I don't understand why we would need to know this immediately when we create |
Just to be sure, can you check what type we actually use as the The key question for SDK binary compatibility is: what native interfaces use |
Maybe I didn't express myself clearly. Here's what we need for
For For As a matter of simplicity, I chose to treat both of these uniformly by setting the So this statement:
is mostly correct but not 100% correct. The bit also affects type equality (and as part of it, canonical type computation). |
Talked with John separately and he mentioned that it would be better to have the "is derivable from Swift type" be a query which takes a I'm going to try out this approach, it seems simpler than what I have right now. |
ea58b6e
to
59434a6
Compare
While writing tests, ran into a pre-existing bug with the demangler where
Is missing an
|
Opened #34122 for the existing demangling issue. |
59434a6
to
f804ecb
Compare
f804ecb
to
5e4f8fa
Compare
@swift-ci please test Windows |
@swift-ci please test |
@swift-ci please test windows platform. |
@swift-ci please test Windows platform. |
Build failed |
5e4f8fa
to
650fadc
Compare
@swift-ci please test Windows platform |
@swift-ci please test |
@swift-ci please clean test Windows platform |
@swift-ci please test Windows platform |
650fadc
to
2aa73a1
Compare
@swift-ci please test Windows platform |
@swift-ci please test Windows platform |
Now the issue is |
2aa73a1
to
1c43570
Compare
@swift-ci please test Windows |
1c43570
to
44b017c
Compare
@swift-ci please test Windows |
@swift-ci please test |
ccd6d2f
to
e90e486
Compare
@swift-ci please test |
@swift-ci please test Windows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think all of my substantive comments are satisfied; LGTM.
|
||
// CHECK: p3c: @convention(c) | ||
// CHECK: @convention(c, cType: "void (*)(size_t)") | ||
p3c: @convention(c, cType: "void (*)(void (*)(size_t))") (@convention(c, cType: "void (*)(size_t)") (Int) -> Void) -> Void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder what github is trying to tell us about these colons.
e90e486
to
6cb71c6
Compare
@swift-ci smoke test and merge |
`size_t` differs in 32 bit platforms like Android ARMv7 where it is `unsigned int` instead of `unsigned long`. The mangling changes one of the characters. The original tests are disabled in Android, and they are replicated in different files for Android, with both the 32 and the 64 bits versions of the mangling and the function signatures. The original tests are not modified in order to avoid complicated checks to avoid platforms like iphonesimulator-i386, which is a 32 bit platform, but still uses `unsigned long` as the underlying type for `size_t` Both tests started failing after swiftlang#34057 landed in the Android 32 bits CI machines.
Marking as a draft as there are a bunch of TODOs.
cType
if it is canonical.