[PATCH] D72448: [clang-tidy] readability-redundant-string-init now flags redundant initialisation in Field Decls and Constructor Initialisers
Eugene Zelenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 9 06:56:17 PST 2020
Eugene.Zelenko added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp:24
+namespace {
+const CXXConstructExpr *getConstructExpr(const CXXCtorInitializer &CtorInit) {
+ Expr *InitExpr = CtorInit.getInit();
----------------
Please use static instead of anonymous namespaces. Same below.
================
Comment at: clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp:26
+ Expr *InitExpr = CtorInit.getInit();
+ if (auto *CleanUpExpr = dyn_cast<ExprWithCleanups>(InitExpr))
+ InitExpr = CleanUpExpr->getSubExpr();
----------------
Could it be const auto *?
================
Comment at: clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp:143
+ Result.Nodes.getNodeAs<CXXCtorInitializer>("ctorInit")) {
+ if (auto *Member = CtorInit->getMember()) {
+ if (!Member->hasInClassInitializer() ||
----------------
Could it be const auto *?
================
Comment at: clang-tools-extra/clang-tidy/readability/RedundantStringInitCheck.cpp:155
+ }
+ const auto *Construct = getConstructExpr(*CtorInit);
+ if (!Construct)
----------------
Please don't use auto when type is not explicitly spelled in same statement or iterator.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72448/new/
https://reviews.llvm.org/D72448
More information about the cfe-commits
mailing list