This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] introducing cppcoreguidelines-enum-all-caps check
AbandonedPublic

Authored by omtcyf0 on Dec 21 2015, 12:55 AM.

Details

Reviewers
None
Summary

This patch introduces cppcoreguidelines-enum-all-caps, which flags all ALL_CAPS enumerations.

As written in C++ Core Guidelines: enumerations should not be named using ALL_CAPS to avoid clashes with macros.

This rule is part of the "Enumerations" profile of the C++ Core Guidelines, see
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-enum5-dont-use-all_caps-for-enumerators

Diff Detail

Event Timeline

omtcyf0 updated this revision to Diff 43347.Dec 21 2015, 12:55 AM
omtcyf0 retitled this revision from to [clang-tidy] introducing cppcoreguidelines-enum-all-caps check.
omtcyf0 updated this object.
omtcyf0 added reviewers: alexfh, chapuni, klimek.
omtcyf0 added a subscriber: cfe-commits.
alexfh edited edge metadata.Dec 21 2015, 4:41 AM

There's already the readability-identifier-naming check that is highly configurable. It might miss the "use any naming style except for this one" functionality, but I'd prefer it to be added to that check rather than implementing another check for naming styles. After the required functionality is added to the readability-identifier-naming check, we can just register it in the cppcoreguidelines module with a custom name (corresponding to the rule) and a custom configuration that only enables verification of enumerator names (see GoogleModule::getModuleOptions() for an example of how to do this).

@alexfh, Thanks for the feedback!

What you said seems reasonable to me, I'll follow your advice and come up with the proposed solution!

alexfh requested changes to this revision.Feb 25 2016, 4:26 AM
alexfh edited edge metadata.
This revision now requires changes to proceed.Feb 25 2016, 4:26 AM
omtcyf0 abandoned this revision.Aug 10 2016, 2:21 AM