[PATCH] D43500: modernize-use-default-member-init: Remove trailing comma and colon.
Eugene Zelenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 20 10:42:26 PST 2018
Eugene.Zelenko added inline comments.
================
Comment at: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:15
+#include "../utils/LexerUtils.h"
+
----------------
Please place it on a top, since header belong to project.
================
Comment at: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:26
+ tok::TokenKind K) {
+ for (;;) {
+ Token Tok = utils::lexer::getPreviousToken(*Context, Location);
----------------
Please use while (true) instead.
================
Comment at: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:48
+ auto NextInit = std::next(pos);
+ if (NextInit != Ctor->init_end()) {
+ return (*NextInit)->getSourceLocation();
----------------
Unnecessary curvy brackets.
================
Comment at: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:177
+ IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true) != 0),
+ RemovedInitializers() {}
----------------
Unnecessary initializer. See [[ http://clang.llvm.org/extra/clang-tidy/checks/readability-redundant-member-init.html | readability-redundant-member-init ]].
================
Comment at: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:271
+
+ if (++RemovedInitializers[Ctor] == Ctor->getNumCtorInitializers()) {
+ removeTrailingColon(Diag, Result.Context, Ctor);
----------------
Unnecessary curvy brackets.
================
Comment at: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:298
+ if (sameValue(NextInit->getMember()->getInClassInitializer(),
+ NextInit->getInit())) {
+ // The next initializer will be removed later. Removing only the
----------------
Unnecessary curvy brackets.
================
Comment at: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:302
+ Diag << FixItHint::CreateRemoval(Init->getSourceRange());
+ } else {
+ // The next initializer will not be remove. In this case, we should create
----------------
Unnecessary curvy brackets.
================
Comment at: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:308
+ }
+ } else {
+ // This initializer is in the middle of other one.
----------------
Unnecessary curvy brackets.
================
Comment at: clang-tidy/modernize/UseDefaultMemberInitCheck.cpp:317
+
+ if (++RemovedInitializers[Ctor] == Ctor->getNumCtorInitializers()) {
+ removeTrailingColon(Diag, Result.Context, Ctor);
----------------
Unnecessary curvy brackets.
================
Comment at: unittests/clang-tidy/ModernizerModuleTest.cpp:62
+}
+} // namespace test
+} // namespace tidy
----------------
Please separate function from namespaces ends with empty line.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D43500
More information about the cfe-commits
mailing list