Skip to content

Override ObjC's class_getImageName to handle Swift classes #17910

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

Merged
merged 2 commits into from
Jul 13, 2018

Conversation

jrose-apple
Copy link
Contributor

This not only restores the correct behavior for classes with generic ancestry, but also handles actual generic classes as well. (This is the function that backs Foundation's Bundle.init(for: AnyClass) initializer.)

Note that this won't actually do anything yet; the ObjC runtime pieces have to be present first, and they aren't. I've run this by @gparker42 already, though, as well as tested it with a custom build of libobjc, and things seem to work.

SR-1917
rdar://problem/33450609&40367300

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test source compatibility

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 5814d401ab86898138e89d049c98846cff4648a4

@jrose-apple
Copy link
Contributor Author

jrose-apple commented Jul 12, 2018

…That's what I get for adding the arclite change last minute. I'll fix that test in a bit.


// Note: The following typealias uses AnyObject instead of AnyClass so that
// the function type is trivially bridgeable to Objective-C. (The
// representation of AnyClass is not the same as Objective-C's 'Class' type.)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, and this comment is supposed to be up with the typealias, which I moved.

@jrose-apple jrose-apple force-pushed the better-class_getImageName branch from 5814d40 to 06e7583 Compare July 12, 2018 20:20
@jrose-apple
Copy link
Contributor Author

Test changes only, source compat suite already passed.

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 5814d401ab86898138e89d049c98846cff4648a4

@jrose-apple jrose-apple force-pushed the better-class_getImageName branch from 06e7583 to 2985cca Compare July 12, 2018 20:21
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 06e7583726d2ac727b0574bc2d61def87ff74e65

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 06e7583726d2ac727b0574bc2d61def87ff74e65

This not only restores the correct behavior for classes with generic
ancestry, but also handles actual generic classes as well. (This is
the function that backs Foundation's Bundle.init(for: AnyClass)
initializer.)

https://bugs.swift.org/browse/SR-1917
rdar://problem/33450609&40367300
For the upcoming hook in the ObjC runtime for class_getImageName
(see previous commit).
@jrose-apple jrose-apple force-pushed the better-class_getImageName branch from 2985cca to df974b2 Compare July 12, 2018 22:49
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 2985cca966364357234b7683780354a666d962bd

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 2985cca966364357234b7683780354a666d962bd

@jrose-apple jrose-apple merged commit db4ceae into swiftlang:master Jul 13, 2018
@jrose-apple jrose-apple deleted the better-class_getImageName branch July 13, 2018 15:56
jrose-apple added a commit to jrose-apple/swift that referenced this pull request Jul 13, 2018
…mageName

Override ObjC's class_getImageName to handle Swift classes

https://bugs.swift.org/browse/SR-1917
(cherry picked from commit db4ceae)
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