[PATCH] [clang-tidy] Add a checker for implicit bool conversion of a bool*.
Daniel Jasper
djasper at google.com
Thu Jul 10 03:15:04 PDT 2014
================
Comment at: clang-tidy/misc/BoolPointerImplicitConversion.cpp:47
@@ +46,3 @@
+ // dereferenced.
+ auto *Var = dyn_cast<DeclRefExpr>(SourceExpr);
+ if (!Var)
----------------
You could move this part into your matcher with something like
expr(ignoringImpCasts(declRefExpr().bind("expr")))
================
Comment at: test/clang-tidy/misc-bool-pointer-implicit-conversion.cpp:1
@@ +1,2 @@
+// RUN: $(dirname %s)/check_clang_tidy_fix.sh %s misc-bool-pointer-implicit-conversion %t
+// REQUIRES: shell
----------------
Maybe add a test cases with a binary expression in the if condition.
================
Comment at: test/clang-tidy/misc-bool-pointer-implicit-conversion.cpp:15
@@ +14,3 @@
+ if (!b) {
+ // no-warning
+ }
----------------
Don't you need at least one more CHECK-MESSAGES-NOT: warning to verify that there aren't any further warnings?
http://reviews.llvm.org/D4458
More information about the cfe-commits
mailing list