Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/include/clang/Lex/Token.h | ||
---|---|---|
101 | This change is necessary to make isOneOf work with a single argument (and also no arguments). isOneOf is called from findNextAnyTokenKind, which is used in this patch with a single token type. |
clang-tools-extra/docs/clang-tidy/checks/performance/missing-move-constructor.rst | ||
---|---|---|
6 | Please synchronize this sentence with Release Notes. |
What is the purpose of this check when we have cppcoreguidelines-special-member-functions.
Granted that check won't emit replacements, however the replacements that this check generates would often not improve performance or potentially introduce a bug.
I know its not nearly the same, but clangd can also fix this interactively with its special members refactor
Hi Nathan, thanks for looking into this. I did indeed not know about the existing check in cppcoreguidelines -- maybe I should've been more suspicious about assuming something so obvious supposedly doesn't exist yet :)
But perhaps the replacements could still be integrated into the existing check. Note that replacements in my patch are generated only if you have a defaulted copying version. So e.g. the defaulted move constructor is emitted only if the class has a default copy constructor. This can still introduce bugs, but I think the probability for that is fairly low.
For context, I'm trying to run this on the chromium codebase, where copy constructors are required to be defined (even if = default) in the .cpp file for all non-trivial classes, which is why the implicit move constructors are often missing. I want to understand what the performance impact of that is.
the replacements that this check generates would often not improve performance
Why would you expect there to be no improvement? If there's a default copy constructor and hence no (implicit) move constructor, than the more expensive copying version will be invoked when a move would be sufficient.
Please synchronize this sentence with Release Notes.