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

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 5 07:50:03 PDT 2023


PiotrZSL added a comment.

Thank you for review, I will correct comments in this week.



================
Comment at: clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp:107
+    CheckFactories.registerCheck<EnumToBoolConversionCheck>(
+        "bugprone-enum-to-bool-conversion");
     CheckFactories.registerCheck<ExceptionEscapeCheck>(
----------------
carlosgalvezp wrote:
> I think the name is a bit generic, do we foresee risk of conflict with other similar checks in the future? I wonder if we should narrow it down to something like `bugprone-non-zero-enum-to-bool-conversion`. WDYT?
I'm fine with name change....


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/bugprone/enum-to-bool-conversion.rst:41
+        {
+            // this true-branch in theory wont be executed
+            return;
----------------
carlosgalvezp wrote:
> carlosgalvezp wrote:
> > won't
> Remove?
enums are ints, you can assign them any value by using static casts or when reading data from external message, so thats why in theory, but in this example you right, there is no "in theory"


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