Skip to content

[5.0][Stdlib][Overlays] Rename various classes to avoid conflicting ObjC names. #21433

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

Conversation

mikeash
Copy link
Contributor

@mikeash mikeash commented Dec 19, 2018

Cherry-pick #21331 for swift-5.0-branch.

Old Swift and new Swift runtimes and overlays need to coexist in the same process. This means there must not be any classes which have the same ObjC runtime name in old and new, because the ObjC runtime doesn't like name collisions.

When possible without breaking source compatibility, classes were renamed in Swift, which results in a different ObjC name.

Public classes were renamed only on the ObjC side using the @_objcRuntimeName attribute.

This is similar to the work done in pull request #19295. That only renamed @objc classes. This renames all of the others, since even pure Swift classes still get an ObjC name.

rdar://problem/46646438

@mikeash mikeash requested a review from a team as a code owner December 19, 2018 17:24
@mikeash
Copy link
Contributor Author

mikeash commented Dec 19, 2018

apple/swift-lldb#1162

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 50b9a3ea371ad080f9ca8248ce6f4c4b92547e85

@mikeash mikeash force-pushed the rename-avoid-objc-conflicts-5.0 branch from 50b9a3e to 60dd607 Compare December 19, 2018 17:58
@mikeash
Copy link
Contributor Author

mikeash commented Dec 19, 2018

apple/swift-lldb#1162

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 50b9a3ea371ad080f9ca8248ce6f4c4b92547e85

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 50b9a3ea371ad080f9ca8248ce6f4c4b92547e85

@mikeash
Copy link
Contributor Author

mikeash commented Dec 19, 2018

@apple/swift5-branch-managers Not required for convergence. This is ABI breaking. Most of the changes are not, as @_objcRuntimeName isn't ABI (everything ABI refers to the Swift name) and many of the straight name changes are to private classes. However, a few of the internal types renamed here are @usableFromInline, so those names are part of the ABI.

Note that the corresponding lldb PR needs to be merged at the same time as this one:
apple/swift-lldb#1162

@bob-wilson
Copy link
Contributor

Let's get the change reviewed and merged to master before we do this one.

Copy link
Contributor

@bob-wilson bob-wilson left a comment

Choose a reason for hiding this comment

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

Please update this to match the changes on master and wait a day or two before merging this in case there is unexpected fallout on master.

@mikeash mikeash force-pushed the rename-avoid-objc-conflicts-5.0 branch from 60dd607 to 732decc Compare January 16, 2019 17:37
@mikeash
Copy link
Contributor Author

mikeash commented Jan 16, 2019

apple/swift-lldb#1162

@swift-ci please test

@mikeash
Copy link
Contributor Author

mikeash commented Jan 16, 2019

This is now up to date with the changes that were merged to master. When merging this one, be sure to merge apple/swift-lldb#1162 at the same time.

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 60dd6070bd9474d81423eb0efac9965ae5b052d7

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 60dd6070bd9474d81423eb0efac9965ae5b052d7

…ames.

Old Swift and new Swift runtimes and overlays need to coexist in the same process. This means there must not be any classes which have the same ObjC runtime name in old and new, because the ObjC runtime doesn't like name collisions.

When possible without breaking source compatibility, classes were renamed in Swift, which results in a different ObjC name.

Public classes were renamed only on the ObjC side using the @_objcRuntimeName attribute.

This is similar to the work done in pull request swiftlang#19295. That only renamed @objc classes. This renames all of the others, since even pure Swift classes still get an ObjC name.

rdar://problem/46646438
…mes.

This avoids name conflicts between generic classes in the Swift modules of the old and new stdlibs when loaded into the same process.
@mikeash mikeash force-pushed the rename-avoid-objc-conflicts-5.0 branch from 732decc to d1b9293 Compare January 17, 2019 16:33
@mikeash
Copy link
Contributor Author

mikeash commented Jan 17, 2019

apple/swift-lldb#1162

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 732decc0c8f1aedb86d7a33297c4765379016646

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 732decc0c8f1aedb86d7a33297c4765379016646

@mikeash
Copy link
Contributor Author

mikeash commented Jan 17, 2019

Master seems to be holding up. Merging this one.

@mikeash mikeash merged commit c5466ad into swiftlang:swift-5.0-branch Jan 17, 2019
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