[PATCH] D72217: [clang-tidy] Added readability-qualified-auto check
Nathan James via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 7 07:24:21 PST 2020
njames93 marked 7 inline comments as done.
njames93 added a comment.
What do you think about volatile qualifiers. Personally I don't think its important to qualify an volatile on a pointer that is volatile, but i should adhere to the decl being declared as volatile
volatile auto X = getPointer();
//transform to
auto *X volatile = getPointer();
auto X = getVolatilePointer();
//transform to
auto *X = getVolatilePointer();
================
Comment at: clang-tools-extra/clang-tidy/readability/QualifiedAutoCheck.cpp:61
+ Diag << FixItHint::CreateReplacement(
+ FixItRange, IsPtrConst ? "const auto *const " : "auto *const ");
+ } else {
----------------
JonasToth wrote:
> the outer const might be debatable. some code-bases don't want the `* const`, i think neither does LLVM. maybe that could be configurable?
The outer const is only there if the vardecl was already declared as const
```
const auto X = getPointer();
auto *const X = getPointer();
```
Those 2 decls are functionally identical, both mean that the pointer X can't change but X is pointing to data that can change
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72217/new/
https://reviews.llvm.org/D72217
More information about the cfe-commits
mailing list