Skip to content
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

Add type_replacements option to control output of name mangling #720

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

YuhanLiin
Copy link

This PR introduces the mangle.type_replacements option, allowing users to replace type parameter names with their own strings when name mangling. This enables users to customize and control the output of the name mangling process.

Copy link
Collaborator

@emilio emilio left a comment

Choose a reason for hiding this comment

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

Can you elaborate on the use cases for this that can't be done via just inserting a typedef or such in the prefix? In general I'm not thrilled to add another layer to mangling, this doesn't feel quite like mangling IMO.

@YuhanLiin
Copy link
Author

It's mainly useful for generic enums, since it allows users to control how enum variant names are mangled. So something like enum Foo<Bar> { Variant } doesn't generate a name like FooVariant_Bar. In fact you can even disable the mangling altogether by replacing Bar with nothing, so you just get FooVariant instead. I think this is the only feature that can't be replicated with typedefs, so we could add it as a standalone feature instead.

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.

None yet

2 participants