[clang] [Sema] Warn about omitting deprecated enumerator in switch (PR #138562)

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Tue May 6 01:42:06 PDT 2025


zmodem wrote:

> Fly-by comment: I drafted the following alternative comment in another thread. Please feel free to disregard as I don't know the tone and style of comments in these files. (But I appreciate your consideration for the contents in the message I'd like to see!)
> 
> ```
>       // We currently treat deprecated constants as if they don't exist;
>       // however, note that this current behavior leads to compile-time
>       // false negatives for coverage checking of switch statements. If
>       // a switch is missing a case for a deprecated constant, we will not
>       // emit a diagnostic, even though the deprecated constant might still
>       // be present in legacy use.
> ```

My patch changes the behavior so that deprecated constants are not ignored by the switch coverage warning.

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


More information about the cfe-commits mailing list