[PATCH] D41003: Silence GCC 7 warning by using an enum class.
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 11 12:44:49 PST 2018
RKSimon added inline comments.
================
Comment at: lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp:95
+enum class ColorKind { None, Red, Black };
----------------
fhahn wrote:
> RKSimon wrote:
> > fhahn wrote:
> > > RKSimon wrote:
> > > > (style) Worth using a CK_ prefix?
> > > >
> > > > ```
> > > >
> > > > enum class ColorKind { CK_None, CK_Red, CK_Black };
> > > > ```
> > > enum classes are strongly scoped, so any access needs to be prefixed with `ColorKind::`. With that, having a CK_ prefix seems slightly redundant to me. What do you think?
> > https://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly
> Hm, it says `Unless the enumerators are defined in their own small namespace or ...`. My understanding is that enum class define the enumerators in their own namespace (although the coding standard could explicitly spell out the enum class case). Also, I had a look at a couple of files with enum classes and all enumerators were without prefix.
Fair enough.
https://reviews.llvm.org/D41003
More information about the llvm-commits
mailing list