[PATCH] D45601: Warn on bool* to bool conversion

Stephan Bergmann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 17 02:12:07 PDT 2018


sberg added a comment.

A random data point from trying this patch on the LibreOffice code base:

- a little over 100 cases that are easily identified as false positives (many of the form "if (p) *p = ...")

- two or three cases that looked suspicious on first glance but turned out to be false positives too (but where the code apparently benefits from cleaning up)

- two cases of false positives that are awkward to silence (via "!= nullptr") in a way compatible with older C++ standards, as they are of the form "if (bool * p = ...)", and can be rewritten to "if (bool * p = ...; p != nullptr)" only for recent C++

- one false positive in system-provided /usr/include/qt5/QtCore/qstring.h

- no true positives found


https://reviews.llvm.org/D45601





More information about the cfe-commits mailing list