[PATCH] D72217: [clang-tidy] Added readability-qualified-auto check
Nathan James via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 28 05:09:22 PST 2020
njames93 added a comment.
In D72217#1844262 <https://reviews.llvm.org/D72217#1844262>, @sammccall wrote:
> The text/rule there is explicitly about avoiding/clarifying copies - the examples indeed use 'const' but AFAICT the "don't copy" reasoning only applies to including *&.
>
> FWIW I think const here is often noise, particularly in AST-walking code where you're traversing an edge from an X* to a Y* - the latter will be const if the former is, and I care at API boundaries but not in between. (It's usually a meaningless distinction - e.g. we're just reading but it's a non-const pointer because RecursiveASTVisitor isn't const-friendly).
>
> So while spelling const is often helpful, we shouldn't (and don't) require it, and the current config of this check is too intrusive.
I have always been a little unsure, a few of the patches I have submitted reviewers have said to add `const` to `auto *` or turn `auto` into `const auto *` which gave the impression its a guideline. Could add an option to the check to forgo the const qualifier checks though.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72217/new/
https://reviews.llvm.org/D72217
More information about the cfe-commits
mailing list