-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Mangling: enable new mangling for symbols #8126
Conversation
@swift-ci Please test and merge |
@swift-ci Please clean test linux |
Build failed |
lib/Basic/Mangler.cpp
Outdated
@@ -32,6 +32,7 @@ llvm::cl::opt<bool> NewManglingForTests( | |||
|
|||
#ifndef USE_NEW_MANGLING | |||
|
|||
#ifndef USE_NEW_MANGLING |
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.
Seems like this #ifndef
is a duplication
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.
Thanks, I'll remove it
This PR must be in sync with swiftlang/swift-corelibs-foundation#919 |
swiftlang/swift-corelibs-foundation#919 @swift-ci Please test |
Build failed |
Build failed |
swiftlang/swift-corelibs-foundation#919 @swift-ci Please test |
Build failed |
Build failed |
swiftlang/swift-corelibs-foundation#919 @swift-ci Please test |
Build failed |
Build failed |
@swift-ci Please clean test linux |
Build failed |
swiftlang/swift-corelibs-foundation#919 @swift-ci Please clean test linux |
Triple-checking: does this break serialized archives that have old mangled names in them, which will be looked up at runtime on both Apple (ObjC) and non-Apple platforms? |
@jrose-apple Not this change. It affects only symbol mangling. AFAIK, archives use the type names stored at runtime. |
On Linux we do something else and I can't remember what it is and now I'm worried. :-) @jckarter, @dgrove-oss, @phausler? Is this something we'll have to worry about? |
This breaks darwin archives but only in a specific case they encode the NSStringFromClass which emits the mangled name in the cases of sub types IIRC. import Foundation
class Foo { class Bar { } }
// emulate what NSKeyedArchiver does to store the class name
print(NSStringFromClass(Foo.self))
print(NSStringFromClass(Foo.Bar.self)) |
do we have a work-around to support archives that use the old names? |
@phausler You are right, only the names of classes changed if the class is
No |
So this will result in external developers having applications that will no longer be able to open archives from previous versions of swift. That is a data loss case. Marking a class private is totally reasonable for developers to do. Changing the type such that it is serialized to disk as something different in the archive will cause users to not be able to open documents they previously saved in older versions of apps. |
Unfortunately in this respect, the archive format is ABI dependent and as we didn't freeze the ABI yet, there will be a breakage. |
As a side note, the name for private classes depend on the module name and the source file name where the class is defined. So if the developer changes any of those, it will also break the archive. |
Right, we've talked about this before. Private classes are currently out of scope unless the user specifies a custom objc name or uses the NSKeyedArchiver callbacks to control the name. Generic classes have to use the callbacks because they may not exist yet. |
So the only remaining type of classes is non-top level classes. Can we just require to use the callback for those classes as a workaround? |
I don't think users should ever have to think about mangling. I'd rather have the old -> new translation as a fallback path. |
Finally
rdar://problem/24085509