-
Notifications
You must be signed in to change notification settings - Fork 444
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
Fix some problems and suggestions found by clang-tidy #4237
Conversation
55f5ebb
to
a4e4f0f
Compare
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.
Any chance we can make this a part of our CMake setup? Ideally, we can run clang-tidy checks as part of CI/ or just apply fix-its automatically. We can tweak the .clang-tidy
file as needed.
@@ -51,11 +51,14 @@ struct StringRef { | |||
len = 0; | |||
} | |||
StringRef(const StringRef &a) : p(a.p), len(a.len) {} | |||
// avoid clang-tidy complaining | |||
// NOLINTBEGIN(bugprone-unhandled-self-assignment) |
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.
if(this == &a)
return *this;
instead?
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.
This one is safe to be performed, I'm not sure if the if is worth having in such cases. If the if is there, one would have to wonder why it is needed.
All these are found by the clang-tidy static analyzer. At this point, I've been only running in on the headers as this is mainly a byproduct of linting a downstream tool. Some of these changes are in the readability category rather than possible bugs, but I think they are all worth applying.