[PATCH] D65562: Move LangStandard*, InputKind::Language to Basic

Rainer Orth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 4 06:31:06 PDT 2019

ro added inline comments.

Comment at: include/clang/Basic/LangStandard.h:19
+/// standard and possible actions.
+enum Language {
+  Unknown,
rnk wrote:
> ro wrote:
> > rnk wrote:
> > > Is it feasible to make this an `enum class`? I'm worried about namespace clashes on these otherwise very short names, like C, CXX, HIP, etc. It should be straightforward and mechanical to replace most existing instances of `InputKind::` with `Language::`. It would also remove the need to make an exception for `LF_OpenCL`.
> > That works perfectly indeed, and is way clearer than my hack
> > with LF_OpenCL.
> > 
> > There's only one downside: I had to change InputKind.Lang
> > from a 4-bit bitfield to Language, otherwise neither assignment
> > nor comparison would work.  No idea if that's really a problem.
> I don't think it matters, but I would like to keep InputKind 32-bits or less. The easy way would be to use `enum class Language : uint8_t` here. The other way would be to keep the bitfield and add a static cast in the constructor. I see getLanguage() already performs one, so most of the uses shouldn't need a change.
I decided to be lazy this time and went for the first alternative.

  rC Clang



More information about the cfe-commits mailing list