[PATCH] D19165: [clang-tidy] Add modernize-increment-bool check.
Piotr Padlewski via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 15 16:19:00 PDT 2016
Prazek added a comment.
Besides comments, looks good to me. But before posting make sure that clang-diagnostics doesn't already have fixits.
================
Comment at: clang-tidy/modernize/IncrementBoolCheck.cpp:51
@@ +50,3 @@
+ // Don't fix if expression type is dependent on template initialization
+ if (MatchedExpr->isTypeDependent())
+ return;
----------------
doesn't isInTemplateInstantiation fix it?
================
Comment at: clang-tidy/modernize/ModernizeTidyModule.cpp:38
@@ -36,1 +37,3 @@
"modernize-deprecated-headers");
+ CheckFactories.registerCheck<IncrementBoolCheck>(
+ "modernize-increment-bool");
----------------
run git-clang-format on your patch, because I see that perhaps this one and other files coud be clang-formatted
================
Comment at: docs/clang-tidy/checks/modernize-increment-bool.rst:50-55
@@ +49,8 @@
+
+ /* Equivalent to:
+ if (!first) {
+ second = false;
+ first = true;
+ }
+ */
+ if (!first) second = first++;
----------------
put this one under the if statment and remove comments liek this:
if (!first)
second = first++;
// is equivalent to
if (!first) {
second = false;
first = true;
}
http://reviews.llvm.org/D19165
More information about the cfe-commits
mailing list