-
Notifications
You must be signed in to change notification settings - Fork 37.4k
refactor: make member functions const when applicable #25673
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
Conversation
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.
Codebase-wide changes like this tend to be a difficult sell. Some initial thoughts.
Pro:
Caveat:
- Const member functions need to be thread safe
Related:
|
8161430
to
fe9f78a
Compare
my mistake, I've dropped the commit |
Yeah, we should probably check this with https://clang.llvm.org/extra/clang-tidy/checks/bugprone/move-forwarding-reference.html |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
fe9f78a
to
c6319de
Compare
I assume this is being done with some automated tooling? If so, could you expand the PR description to describe what you are doing to produce the change? Similar to #25707, if you want to make a change like this, we'd likely also want this enforced/linted in some way. Are there any checks you can use in https://releases.llvm.org/14.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/list.html? |
Can tooling ensure these member functions marked as const are all thread-safe? |
053dd01
to
f73c294
Compare
f73c294
to
6291d90
Compare
6291d90
to
3f9eeec
Compare
Done. Also rebased. |
3f9eeec
to
c05b1ff
Compare
c05b1ff
to
f4d5cc0
Compare
fadb393
to
cb9009b
Compare
cb9009b
to
9112ec7
Compare
🐙 This pull request conflicts with the target branch and needs rebase. Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft". |
why the close? Seems a risk free CI check to avoid spending time on this during review? |
@MarcoFalke I was asked during coredev to close this.
|
I have added a clang-tidy check: 'readability-make-member-function-const'.
I believe this makes the code more maintainable.
I used clang-tidy with
--fix-errors
and the checkreadability-make-member-function-const
to generate the refactor commit.