-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Mangling] Include private discriminators in constructor manglings #9880
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] Include private discriminators in constructor manglings #9880
Conversation
14f0bdd
to
20fe54c
Compare
20fe54c
to
20365a9
Compare
@swift-ci Please test |
@swift-ci Please test Linux |
20365a9
to
55462f1
Compare
Already passed full testing before I added more tests. @swift-ci Please smoke test |
docs/ABI.rst
Outdated
entity-spec ::= type 'fC' // allocating constructor | ||
entity-spec ::= type 'fc' // non-allocating constructor | ||
entity-spec ::= file-discriminator? type 'fC' // allocating constructor | ||
entity-spec ::= file-discriminator? type 'fc' // non-allocating constructor |
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 better to add the optional discriminator after the type:
entity-spec ::= type file-discriminator? 'fc'
Having optional terms at the beginning of a rule can be problematic because when demangling it's not clear if they belong to that rule or to then "enclosing" rule.
For the file-discriminator it's actually not a problem because it's not used elsewhere. But to be consistent (and future prove) I'd prefer to change it.
Alternatively you could also just add a new character to 'f' instead of file-discriminator
entity-spec ::= type identifier 'fB' // allocating file-discriminated constructor
entity-spec ::= type identifier 'fb' // non-allocating file-discriminated constructor
Previously, two constructors with the same full name and argument types would get identical manglings even if they were declared 'private' or 'fileprivate' in different files. This would lead to symbol collisions in whole-module builds. Add a new mangling node for private discriminators on base-name-less decls to make this unique. This still doesn't fix the existing issue with private members, named or not, conflicting when they're in the /same/ file, but since Swift 4 makes those members visible to one another (SE-0169) that's only an issue in Swift 3 mode anyway, and as such probably won't get fixed at all. rdar://problem/27758199
55462f1
to
7ff8e0b
Compare
@swift-ci Please smoke test |
Previously, two constructors with the same full name and argument types would get identical manglings even if they were declared
private
orfileprivate
in different files. This would lead to symbol collisions in whole-module builds. Add a new mangling node for private discriminators on base-name-less decls to make this unique.This still doesn't fix the existing issue with private members, named or not, conflicting when they're in the same file, but since Swift 4 makes those members visible to one another (SE-0169) that's only an issue in Swift 3 mode anyway, and as such probably won't get fixed at all.
rdar://problem/27758199