[PATCH] D144036: [clang-tidy] Add bugprone-enum-to-bool-conversion check

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 8 10:15:18 PDT 2023


PiotrZSL marked 14 inline comments as done.
PiotrZSL added inline comments.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/bugprone/enum-to-bool-conversion.rst:12-13
+
+The check produces false positives if the ``enum`` is used to store other values
+(used as a bit-mask or zero-initialized on purpose). To deal with false-positives,
+``//NOLINT`` or casting first to the underlying type before casting to ``bool``
----------------
carlosgalvezp wrote:
> I can't think of a case where this could happen, might be worth adding an example below.
I thinkg that in STL we got some enums (flags) used as bitmasks... Just wanted to mention that there could be some known false-positives.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144036/new/

https://reviews.llvm.org/D144036



More information about the cfe-commits mailing list