-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
[clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… #65231
[clang-tidy][NFC][doc] Improve documentation for modernize-use-equals… #65231
Conversation
…-delete So the purpose of the check is more clear. Update examples code to show compliant code. Fixes llvm#65221
0ffc7aa
to
9c5fec5
Compare
clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
Outdated
Show resolved
Hide resolved
clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe:
Identifies unimplemented private special member functions, recommends using '= delete' for them, and suggests relocating such deleted functions from the private to the public section.
Before the introduction of C++11, the primary method to effectively "erase" a particular function involved declaring it as private without providing a definition. This approach would result in either a compiler error (when attempting to call a private function) or a linker error (due to an undefined reference).
However, subsequent to the advent of C++11, a more conventional approach emerged for achieving this purpose. It involves flagging functions as "= delete" and retaining them within the public section of the code.
To prevent false positives, this check is only applicable within a translation unit where all other member functions have been implemented. The check will generate partial fixes by introducing "= delete," but the user is responsible for manually relocating it to the public section.
clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
Show resolved
Hide resolved
Other interesting thing is that currently this check is limited just to LangOpts.CPlusPlus, when it should be to LangOpts.CPlusPlus11. And in such case documentation could mention that requires C++11 or later. |
Yep, we could certainly change it to C++11 or later, but I think it's out of the scope for this NFC patch. Regarding documentation, I haven't seen that we document this detail in other checks, it seems like an implementation detail that could cause maintenance effort if documented. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Do we want to sync comment above check class in code with first sentence in documentation ? |
Yes good point, will fix! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No more comments from me.
llvm#65231) …-delete So the purpose of the check is more clear. Update examples code to show compliant code. Fixes llvm#65221 --------- Co-authored-by: Carlos Gálvez <carlos.galvez@zenseact.com>
…-delete
So the purpose of the check is more clear. Update examples code to show compliant code.
Fixes #65221