[3.0] Replace NameTrimmer with equivalent IdentifySharedPrefixes mod#2557
Draft
Exanite wants to merge 78 commits intodotnet:develop/3.0from
Draft
[3.0] Replace NameTrimmer with equivalent IdentifySharedPrefixes mod#2557Exanite wants to merge 78 commits intodotnet:develop/3.0from
Exanite wants to merge 78 commits intodotnet:develop/3.0from
Conversation
…ld used by other bindings The default acronym threshold was changed during #29, which was merged as part of dotnet#2503.
Considering we decided to follow Microsoft's Framework Design Guidelines (acronym threshold of 2) for the bindings and rest of the API, might as well be consistent here.
… separation hack (no longer necessary)
…mbers are normalized
This lets us handle prefixing and prettification separately, which notably is important if we add prefixes after prettification. We want to prefix the final name, not the intermediate name in this case.
…igured (cherry picked from commit bc94260)
…ous that it is not the last trimmer
This no longer makes sense to keep and enabling features by baseline version seems fiddly. If we need to toggle features for newer versions, we can explicitly add a boolean config option.
…essor and ReapplyAffixesNameProcessor
Kinda a cop out decision, but it keeps thing simple (and thus maintainable) and implementing it fully seems overkill for what we need.
… for function pointer types are named
This is because we no longer output the separating underscore in ExtractNestedTyping
… of INameTrimmer registrations
…ed-struct-name-affixes
…nvention Note that the goal is to eventually remove the name overrides for the `EFXEAXREVERBPROPERTIESflLateReverbPan` and `-Delegate` cases entirely. This is because these are theoretically possible to handle automatically and the reason it doesn't work is due to an edge case interaction with the name override system. See the "Tasks" section here for more info: dotnet#2555
…hared-prefixes-mod
…ze the foreach loops
This reverts commit 3ec90a7.
This is because 2D isn't trimmed properly by my new name splitter, but I decided that this case was not worth handling in favor of keeping the trimming code simple. See my thoughts here: https://discord.com/channels/521092042781229087/1485943448069738608/1489457083857506336
…amesTests to IdentifySharedPrefixesTests
See dotnet#2557 for full reasoning, but the short is that this edge case is purely theoretical and can be handled later on when actually necessary.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the PR
(WIP)
This PR chains off of #2555 and focuses on rewriting the
NameTrimmerclass as a newIdentifySharedPrefixesmod with equivalent functionality. The goal is to keep all outputs the same while removing edge cases and generally just making the code easier to understand.Note: Part of the reason this PR chains off of #2555 is because #2555 actually needs some of the changes here to fully work correctly. #2555 can be merged as is, but one unit test has to be commented out and a non-critical feature will be missing.
Related issues, Discord discussions, or proposals
This is the conversation in January when this change was briefly discussed: https://discord.com/channels/521092042781229087/587346162802229298/1457864604951777441
Further Comments
Tasks
LenientUnderscorewithNameSplitter-based implementation2Dare split/underscored.LenientUnderscoreoutputs2D, butNameSplitteroutputs2_Din favor of avoiding any special cases. See my reasoning here: https://discord.com/channels/521092042781229087/1485943448069738608/1489457083857506336IdentifySharedPrefixesmod that identifies shared prefixes and uses the name affix system to annotate those prefixes.Ideally rewrite to avoid the "3 pass" logic. I have no idea how it works still.NameSplittercode for consistency (especially since we have thorough test coverage for this code)NameTrimmertestsPrettifyNamesTests. Since the newIdentifySharedPrefixesmod ended up being an almost direct copy of the core trimming code fromNameTrimmer, I decided to not add too many new tests.IdentifiesSharedPrefix_WhenPrefixesDeclared.GLas a prefix forGL_PIXEL_COUNT_NVandGL_PIXEL_COUNT_AVAILABLE_NVto hide it from the shared prefix identification process._PIXEL_COUNT_NVand_PIXEL_COUNT_AVAILABLE_NV._being the shared prefix. This is definitely a bug since I expect_PIXEL_COUNTorPIXEL_COUNT.GLandPIXEL_COUNTshould be the final affixes.GLPIXEL_COUNT, which is definitely not great behavior.INameProcessorto be an interface private toPrettifyNamesINameProcessors