[clang-tidy] Add a checker for implicit bool conversion of a bool*.
authorBenjamin Kramer <benny.kra@googlemail.com>
Fri, 11 Jul 2014 08:08:47 +0000 (08:08 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Fri, 11 Jul 2014 08:08:47 +0000 (08:08 +0000)
commit1c8b31753b0699960d314a67dba2c71ba832e6ae
treebaa10f2e41cb0f56787cb9fe1776011537c8211b
parent780ce0f8e3505e7a3df0ee5f5d421d8e0e253079
[clang-tidy] Add a checker for implicit bool conversion of a bool*.

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.

Differential Revision: http://reviews.llvm.org/D4458

llvm-svn: 212797
clang-tools-extra/clang-tidy/misc/BoolPointerImplicitConversion.cpp [new file with mode: 0644]
clang-tools-extra/clang-tidy/misc/BoolPointerImplicitConversion.h [new file with mode: 0644]
clang-tools-extra/clang-tidy/misc/CMakeLists.txt
clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
clang-tools-extra/test/clang-tidy/misc-bool-pointer-implicit-conversion.cpp [new file with mode: 0644]