[PATCH] D72217: [clang-tidy] Added readability-qualified-auto check
Mark de Wever via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 5 06:03:18 PST 2020
Mordante added a comment.
Nice to see this patch! I intended to look at a similar patch, but that's no longer required.
One question does it also handle cases like `std::vector<int **> PtrPtrVec;` properly?
================
Comment at: clang-tools-extra/test/clang-tidy/checkers/readability-qualified-auto.cpp:19
+ auto NakedPtr = getIntPtr();
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'auto variable' can be declared as an 'auto pointer'
+ // CHECK-FIXES: {{^}} auto * NakedPtr = getIntPtr();
----------------
Wouldn't it be nicer to write 'auto NakedPtr' can be declared as an 'auto *NakedPtr' ?
(Likewise for the other warnings.)
================
Comment at: clang-tools-extra/test/clang-tidy/checkers/readability-qualified-auto.cpp:23
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'auto variable' can be declared as a 'const auto pointer'
+ // CHECK-FIXES: {{^}} const auto * NakedCPtr = getCIntPtr();
+
----------------
I looks like the fix adds an extra space character after the `*` in `auto * NakedCPtr`
================
Comment at: clang-tools-extra/test/clang-tidy/checkers/readability-qualified-auto.cpp:27
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: 'auto variable' can be declared as an 'auto pointer'
+ // CHECK-FIXES: {{^}} auto *const ConstPtr = getIntPtr();
+ const auto ConstCPtr = getCIntPtr();
----------------
I looks like the fix adds an extra space character, giving two spaces in `const ConstPtr`
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