Fixes (clang-tidy) readability-identifier-naming misses fixing member variables in destructor and readability-identifier-naming does not rename class members in all locations
I've tried to be pretty exhaustive with test cases, but there will always be some edge cases
Details
- Reviewers
aaron.ballman
Diff Detail
Event Timeline
Thank you for fixing these bugs!
Did you try running the check of clang/llvm again, to see if there are still missing cases of this?
clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp | ||
---|---|---|
571 | these all seem to be an artifact of running clang-format? | |
736 | this change violates the coding guideline. | |
821 | const auto * to show that this variable is a pointer. | |
clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-member-decl-usage.cpp | ||
89 | I dont understand this comment. What do you mean? |
Ahh clang format script must have run, I'll undo that. I've not tried running it against the whole of llvm as I don't know what the easy way to do that is, especially given that llvm disregards it's standard naming convention for old projects and stl like containers. The comment is just in relation to the bug report that this fix is based on, could probably go
yeah clang-format tends to do that, as devs do not consistently apply automatic formatting :/
for llvm: https://clang.llvm.org/docs/HowToSetupToolingForLLVM.html
You can use run-clang-tidy.py in the tools/ directory of clang-tidy. Then specify your custom built clang-tidy binary.
The call should like similar to this (not tested):
<path-to-llvm>/llvm-project $ run-clang-tidy.py -p <path-to-build-dir-with-compile-commands> -clang-tidy-binary <path-to-build> -checks=-*,readability-identifier-naming -fix clang/lib
That will run over clang/libs only. If you choose lib/ it will run over each lib-subdirectory of the project.
Maybe you can still try it out and see what diagnostics you get. It will be a good practice anyway, if you plan to keep developing :)
addressed issues. Running the clang-tidy on the whole of lib clang just resulted in errors when compiling due to its dependancy on llvm, but I kind of knew that was going to happen
clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-member-decl-usage.cpp | ||
---|---|---|
137 | I think this is one more test case to add: base class specifiers. e.g., struct foo_bar {}; // Should be renamed struct Baz : foo_bar {}; // Should rename foo_bar |
clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-member-decl-usage.cpp | ||
---|---|---|
137 | That test case already exists in the readability-identifier-naming.cpp file class my_derived_class : public virtual my_class {}; // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for class 'my_derived_class' // CHECK-FIXES: {{^}}class CMyDerivedClass : public virtual CMyClass {};{{$}} |
LGTM!
clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-member-decl-usage.cpp | ||
---|---|---|
137 | Oh, thank you for pointing that out! |
these all seem to be an artifact of running clang-format?
Such a change can be done, but should happen in a separate patch (just formatting does not require review).