[PATCH] D40715: [analyser] different.LabelInsideSwitch checker implementation

Alexey Knyshev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 11 23:37:51 PST 2017


alexey.knyshev added a comment.

In https://reviews.llvm.org/D40715#951665, @dcoughlin wrote:

> Thanks for looking into this!
>
> This checker is in the 'core' package, which means (when moved out of alpha) it will be enabled by default.
>
> - Do you think that this checker should be enabled by default for all users of the analyzer?


I think so

> - If users do actually want to use labels in their switch statements, how should they suppress the diagnostics from the checker?

Good point, is there recommended way to implement options for checker? Where can I find any reference example?

> - What is the benefit of adding this check in the static analyzer vs. in clang-tidy?
> 
> (My own sense is that the check for labels that are close to "default" could be on by default but that warning on *any* label inside a switch is more stylistic. I think users should have to opt in to that check.)

It makes sense. So, I can make generic case when we found any label in swichStmt opt-in (default=off) and left cases when it looks like typo in 'case' or 'default' keywords enabled by default.
Thanks!


Repository:
  rC Clang

https://reviews.llvm.org/D40715





More information about the cfe-commits mailing list