[SERVER-73860] Add performance-unnecessary-copy-initialization clang-tidy check Created: 09/Feb/23 Updated: 02/Feb/24 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Matt Kneiser | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Assigned Teams: |
Build
|
||||||||||||
| Sprint: | Execution Team 2023-02-20, Execution Team 2023-04-17 | ||||||||||||
| Participants: | |||||||||||||
| Description |
|
I've noticed several unnecessary copies of objects occurring in our codebase, often from a misunderstanding/misuse of the auto specifier. There's an existing clang-tidy check that we can leverage to cut down on extraneous copies being made. |
| Comments |
| Comment by Matt Kneiser [ 16/Feb/23 ] |
|
The current version of clang-tidy in the v4 toolchain, v12, is older than the tip of the llvm project, v17. The tip has many useful and relevant improvements to this checker. Namely:
While some copies I found after running this tool made sense, I know that it wasn't perfect and required exclusions like in some tests where the copy constructor was explicitly being invoked.
It might make sense to import the latest version of this tool into our custom checkers suite and modify as necessary. I began this path and found that we need better support from SDP to get all the llvm/clang headers lied up correctly so checks can be imported easily. |