[PATCH] D107641: [clang-tidy] fix duplicate '{}' in cppcoreguidelines-pro-type-member-init
liushuai wang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Aug 7 18:59:26 PDT 2021
MTC added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp:36
template <typename T, typename Func>
void forEachField(const RecordDecl &Record, const T &Fields, Func &&Fn) {
for (const FieldDecl *F : Fields) {
----------------
Btw, the parameter `Record` seems useless, could you clean it up in another patch?
================
Comment at: clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp:439
+ [&](const FieldDecl *F) {
+ if (!HasRecordClasMemberSet.count(F))
+ {
----------------
I believe `DenseSet::contains` is more appropriate here.
================
Comment at: clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp:454
+
+ if (AllFieldsToInit.empty())
+ return;
----------------
`FieldsToInit` being empty implies `AllFieldsToInit` is empty. We have checked the emptiness of `FieldsToInit`.
================
Comment at: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-member-init.cpp:211
// FIXME: The fix-its here collide providing an erroneous fix
int A, B;
----------------
Please update the comments.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107641/new/
https://reviews.llvm.org/D107641
More information about the cfe-commits
mailing list