[LLVMdev] [cfe-dev] draft rule for naming types/functions/variables
John McCall
rjmccall at apple.com
Wed Dec 1 00:32:15 PST 2010
On Nov 30, 2010, at 11:29 PM, Zhanyong Wan (λx.x x) wrote:
> Hi Chris,
>
> I've uploaded a new patch to http://codereview.appspot.com/3264041.
> It's also attached to this message.
>
> I think I've addressed all your comments, except "when in doubt, an
> enum should be a 'Kind'". I don't think I fully understand that
> point, and it strikes me as a bit ad hoc for the coding standards. Do
> we really want it?
>
> If you feel that's important, I'll add it -- but it will need some
> clarification, as the Kind suffix clearly doesn't fit all enums. What
> is it that you really have in mind?
I think Chris means that if you're going to have a type that enumerates all the different kinds of Blah, it should be called something like BlahKind. Seems like a good rule to me; we have several competing conventions right now (e.g. clang::CastKind, clang::Type::TypeClass, and llvm::GlobalValue::LinkageTypes), and I do find myself having to look up these names a fair amount.
Enums for which "Kind" isn't an appropriate suffix shouldn't be suffixed with "Kind". I think there's a general principle somewhere in there. :)
John.
More information about the llvm-dev
mailing list