[clang] [clang][Sema] Add -Wswitch-default warning option (PR #73077)

via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 25 00:46:49 PST 2023


hstk30-hw wrote:

> For example, Folks at google advise against using `default` when switching over an enum https://abseil.io/tips/147.
> Misra requires a default statement, but makes an exception for enums. (6.4.6 in misra 2008)

I see it's easy to implement in LLVM like clang tidy (not warning for enum and constant expr).

The clang tidy may seperate the `switch` warning ( I have to use tidy to see `switch-default`, but I can see `switch-enum` `switch-bool` in compiler).

IMAO, if we can implement it together in compiler, why not?

https://github.com/llvm/llvm-project/pull/73077


More information about the cfe-commits mailing list