Addresses the bugzilla bug #30397. (https://bugs.llvm.org/show_bug.cgi?id=30397)
modernize-use-override suggests that destructors require the override specifier and the CPP core guidelines do not recommend this.
Details
Diff Detail
Event Timeline
Welcome to the LLVM community and thank you for the patch lewmpk!
Please add unit tests for the changes you made to the check. They live in clang-tools-extra/test/clang-tidy/modernize-.....
It is common to add a additional test-file to ensure the configuration options do work as expected.
You can get inspiration from other checks that provide configuration capability (e.g. https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-bool-literals.html#options)
for reference.
If you have any questions don't hesitate to ask!
P.S: Usually we upload the patches with full context (https://llvm.org/docs/DeveloperPolicy.html#making-and-submitting-a-patch) for the reviewer to see the change in context.
clang-tidy/modernize/UseOverrideCheck.cpp | ||
---|---|---|
23 | Please ellide the braces for the single-statements (this if and the else branch) | |
clang-tidy/modernize/UseOverrideCheck.h | ||
23 | That requires additional methods for the function for the configuration to function properly. Please see other checks and implement that the same way. | |
27 | please use private instead |
I think this change is worth mentioning in the release notes as well (cte/docs/ReleaseNotes.rst)
Please resubmit this patch with full context
git diff --cached -U999999 > patch_to_submitt.diff
You need to add some documention describing the new option into the check in
docs/clang-tidy/checks/modernize.... .rst
clang-tidy/modernize/UseOverrideCheck.h | ||
---|---|---|
23 | Could you elaborate? I looked at other checks and they seem to implement it the same way. /llvm/tools/clang/tools/extra/clang-tidy/bugprone/AssertSideEffectCheck.cpp:74 CheckFunctionCalls(Options.get("CheckFunctionCalls", false)), |
Thank you for the contribution! Please see the comments inline.
clang-tidy/modernize/UseOverrideCheck.cpp | ||
---|---|---|
22 | Please prefer early exit: if (!getLangOpts().CPlusPlus11) return; <everything else> | |
docs/ReleaseNotes.rst | ||
71 ↗ | (On Diff #188622) |
|
clang-tidy/modernize/UseOverrideCheck.h | ||
---|---|---|
23 | You need to override the storeOptions() method. |
test/clang-tidy/modernize-use-override-no-destructors.cpp | ||
---|---|---|
6 ↗ | (On Diff #188622) | Remove the semicolons after methods. Clang-format the test (but ensure clang-format doesn't break comments at the 80 character bound). |
I'm trying to find a way to run the test. If someone else has already tested it then yes please.
If you've set up the build with ninja, ninja check-clang-tools should do the right thing. But I'm running the test anyway.
The new test fails even after I fixed the YAML config in the RUN lines. Please fix and re-upload the patch.
Are you planning on landing this anytime soon given that it was accepted? I would like to land D57087: [clang-tidy] add OverrideMacro to modernize-use-override check but I suspect either you are I will need to rebase, I'm just trying to be nice and ask if you'd like to land first?
So one of us could land it for you.. (I've not personally done that before as I'm a bit green too! but I do have commit rights)
Its pretty easy to get commit rights, and given your looking at multiple issues I'd recommend it.. (https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access)
@MyDeveloperDay if you want to try the procedure out, go ahead ;) Otherwise I can land this patch now.
I'll let you folks do this. But please note that the patch wasn't generated with arcanist, so it doesn't apply with arc patch --nobranch. Copy-pasting the raw diff to patch -p0 works though (as would downloading the diff and feeding it to patch as a file). Make sure to put "Differential Revision: https://reviews.llvm.org/D58731" at the end of the message for Phabricator to close this revision automatically.
@JonasToth I left a comment in the commit needed to fix the index.rst, which I don't think your later review fixes, sphinx complained about the rst file being an unreferenced octtree
https://reviews.llvm.org/rG5fbeff797a9dba504f08f14c4fa59b6f1076fe72#inline-2691
That requires additional methods for the function for the configuration to function properly. Please see other checks and implement that the same way.