[PATCH] [clang-tidy] Add a checker for implicit bool conversion of a bool*.

Benjamin Kramer benny.kra at gmail.com
Thu Jul 10 02:58:01 PDT 2014


Hi alexfh, djasper,

The goal is to find code like the example below, which is likely a typo
where someone meant to write "if (*b)".
bool *b = SomeFunction();
 if (b) {
   // b never dereferenced
 }

This checker naturally has a relatively high false positive rate so it
applies some heuristics to avoid cases where the pointer is checked for
nullptr before being written.

http://reviews.llvm.org/D4458

Files:
  clang-tidy/misc/BoolPointerImplicitConversion.cpp
  clang-tidy/misc/BoolPointerImplicitConversion.h
  clang-tidy/misc/CMakeLists.txt
  clang-tidy/misc/MiscTidyModule.cpp
  test/clang-tidy/misc-bool-pointer-implicit-conversion.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4458.11257.patch
Type: text/x-patch
Size: 6533 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140710/1f74ead4/attachment.bin>


More information about the cfe-commits mailing list