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

Eugene Zelenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 13 12:03:33 PDT 2017


Eugene.Zelenko added inline comments.


================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:96
+
+  Finds uses of enumeration values in equality and inequality expressions where a switch would be preferred.
+
----------------
Please highlight switch with `` and indent preferred on same column as beginning of sentence.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/misc-prefer-switch-for-enums.rst:8
+
+A switch statement will robustly identify unhandled enum cases with a compiler
+warning. No such warning exists for control flow based on enum value
----------------
Please highlight switch with ``.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/misc-prefer-switch-for-enums.rst:10
+warning. No such warning exists for control flow based on enum value
+comparison.  Use of switches rather than if statements leads to easier to
+maintain code as adding values to an enum will trigger compiler warnings for
----------------
Please highlight if with ``.


https://reviews.llvm.org/D30896





More information about the cfe-commits mailing list