[PATCH] D30896: [Clang-tidy] add check misc-prefer-switch-for-enums

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 16 11:09:17 PDT 2017

aaron.ballman added a comment.

In https://reviews.llvm.org/D30896#702913, @jbcoe wrote:

> I've played around with a few heuristics but it's still far too contentious to have this check on by default and have it warn in places I want warnings. Where should it go?

Perhaps it should live as a private check rather than a public one?

Alternatively, are you aware of any public coding standard rule that matches the behavior you want? We tend to be a little more relaxed about chattiness when it's part of a check for a public, relatively well-known coding standard because it guides the discussion about what constitutes a false positive. As a case in point, the CERT module has a check for MSC30-C, which prohibits using the `rand()` function. That would be way too contentious of a check normally except that it matches the behavior expected of a check against that CERT rule.

I'm not certain we want a module named "chatty", or something like it, for checks that are over-eager to diagnose code, but that might be another option. It would require a community discussion outside of this code review. (Personally, I'd be opposed to such a module, but don't let that dissuade you from pitching the idea. I'm just one contributor and my mind can certainly be changed in the presence of good rationale.)



More information about the cfe-commits mailing list