[PATCH] D68074: [clang-tidy] Add readability-make-member-function-const

Matthias Gehre via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 9 12:13:30 PDT 2019


mgehre marked 2 inline comments as done.
mgehre added inline comments.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/readability-make-member-function-const.rst:10
+The check conservatively tries to preserve logical costness in favor of
+physical costness. The only operations on ``this`` that this check considers
+to preserve logical constness are
----------------
gribozavr wrote:
> Sorry, it is unclear to me what it means: "the check [...] tries to do X in favor of Y"
> 
> Also unclear what logical/physical constness mean.
I guess it should read `tries to preserve logical constness instead of physical constness.`

logical/physical constness is from here: https://isocpp.org/wiki/faq/const-correctness#logical-vs-physical-state
Are there more common terms for this or should I link or copy the explanation?


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/readability-make-member-function-const.rst:17
+* returning const-qualified ``this``
+* passing const-qualified ``this`` as a parameter.
+
----------------
gribozavr wrote:
> These rules need a justification; if not for the users, but for future maintainers.
> 
> For example, why isn't reading a private member variable OK? Why isn't calling a private member function OK?
> 
Sure! Let's first see if you agree to the rules based on the explanation in my other comment.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68074/new/

https://reviews.llvm.org/D68074





More information about the cfe-commits mailing list