[PATCH] D85697: [clang-tidy] Add cppcoreguidelines-prefer-scoped-enums-over-unscoped

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 19 03:39:55 PDT 2020


njames93 added a comment.

It may be a pain, but I'd also like to see an option like `RemovePrefix`.
Generally most unscoped enums constants have prefixes based on the enum name. A simple way around this would just be to get the longest common prefix in all the enums constants. There is probably some other heuristics that could be used like maybe stop after you reach an underscore or change of case but probably not essential.



================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:82
+
+  Checks for unscoped enumerations.
+
----------------
Could this perhaps be a little more informative?


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-prefer-scoped-enums.rst:35-36
+
+Note: Although ``enum struct`` and ``enum class`` are exactly equivalent, the
+latter is used mainly.
----------------
I'd prefer if this was user controlled, An option like `UseEnumStruct` that defaults to false. Just because its mainly used, doesn't mean there aren't some projects that prefer to use `enum struct`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85697



More information about the cfe-commits mailing list