[PATCH] D30896: [CLANG-TIDY] add check misc-prefer-switch-for-enums

Jonathan B Coe via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 13 10:51:37 PDT 2017

jbcoe marked 2 inline comments as done.
jbcoe added a comment.


  enum Kind k = Kind::a;
  if (k == 3) { /* something */ }

is intentionally out of scope for now as the author is doing something that I can't trivially replace with a switch.

Comment at: clang-tools-extra/test/clang-tidy/misc-prefer-switch-for-enums.cpp:3
+enum class kind { a, b, c, d };
JonasToth wrote:
> maybe another test for non enum class values would be nice.
> ```
> enum another_kind {e, f, g};
> ```
I don't need to write code to specifically deal with enum classes. Perhaps changing the test to just test enums is simpler. I'm not sure what the LLVM/Clang approach normally is.


More information about the cfe-commits mailing list