Add custom clang-tidy check for fields that could be replaced by points #32852
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
SUMMARY: Infrastructure "Add static analysis check for fields that could be replaced by points"
Purpose of change
To help people use higher-level types in their code.
Describe the solution
This check looks for any struct or class containing two or three fields that look like they might be better replaced by a
point
ortripoint
. It identifies them by examining the types and names. So, e.g.int foox, fooy;
whould trigger this check.Add this check and add suppressions for remaining cases triggering it.
I'm also fixing a couple of other random clang-tidy failures that have crept in recently.
Describe alternatives you've considered
There are other potential naming patterns that could be searched for. But this covered most of what seemed to exist in the codebase.
Additional context
It was by running this check that I discovered the code to be refactored for #32732, #32779, #32813, #32822, #32844, #32845. Now all that work is done I can add the check itself.
Next step is to do a similar check for function arguments to update APIs to take
point
arguments.