[PATCH] D4784: [clang-tidy] Add check for possibly incomplete switch statements

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 13 10:26:17 PDT 2023


PiotrZSL added inline comments.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/bugprone/switch-missing-default-case.rst:52
+.. note::
+   Enum types are already covered by compiler warnings when a switch statement
+   does not handle all enum values. This check focuses on non-enum types where
----------------
xgupta wrote:
> PiotrZSL wrote:
> > would be nice to list them
> Didn't understand, what should I list, non-enum types?
No, not a types, compiler warnings (ones for enums). Simply so when user enable this check for integers, He/she could make sure that enum specific warnings are also enabled.
and remove this list that you added, as you cannot do switch on pointers or floating point types.


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/bugprone/switch-missing-default-case.cpp:4
+typedef int MyInt;
+typedef enum { eE2 } MyEnum;
+
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D4784



More information about the cfe-commits mailing list