[swift-dev] Name mangling of subscripts

John McCall rjmccall at apple.com
Fri Jul 14 14:02:41 CDT 2017


> On Jul 14, 2017, at 6:41 AM, Alex Hoppen via swift-dev <swift-dev at swift.org> wrote:
> Hi all,
> 
> With a recent change of mine (#9989 <https://github.com/apple/swift/pull/9989>) subscripts are no longer represented internally by the identifier "subscript" but by a DeclBaseName with a special flag. In name mangling, however, the string "subscript" still surfaces (e.g. _T04test3FooC9subscriptyycfg). I think that we should use a special flag here instead, similar to "fC" for constructors or "fD" for destructors.
> I don't know much about the mangling and which considerations need to be taken here though, so: Would this be a change that is worth doing, even though it gives no immediate benefit? If yes, could someone assist me with the design work of choosing the right mangling scheme or take over the issue? Or should I just file a JIRA for it, assign it the label "AffectsABI" and wait for someone to pick it up as the ABI gets stabilised?

Filing a bug seems appropriate.  If you'd like to also volunteer to fix that bug, that would be great. :)  I agree that we should use a special name in the mangling here, and I disagree that it gives no immediate benefit: if nothing else, it reduces the symbol size by a few bytes.

The only consideration is making sure that the mangling doesn't collide with some other identifier.  Erik (CC'ed) probably has thoughts about that, although he's on vacation until Monday.

John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20170714/41adc6d3/attachment.html>


More information about the swift-dev mailing list