[cfe-dev] Type of Token::Kind must be changed

Anton Lokhmotov Anton.Lokhmotov at arm.com
Thu Jun 23 09:16:05 PDT 2011


In Lex/Token.h, Token::Kind is defined as:

  /// Kind - The actual flavor of token this is.
  ///
  unsigned char Kind; // DON'T make Kind a 'tok::TokenKind';
                     // MSVC will treat it as a signed char and
                     // TokenKinds > 127 won't be handled correctly.

Basic/TokenKinds.def, however, creates tokens and keywords from all
languages and dialects that Clang supports.  Unfortunately, 'unsigned char'
is no longer suitable for its type, as the number of enum values is already
> 250 on TOT (and our OpenCL patches under review overflow it).

I think Clang should use 'unsigned' ('unsigned int') for Token::Kind,
similar to Token::UintData.  I haven't submitted a bug report yet, as I'd
like to discuss this first.

Anton.







More information about the cfe-dev mailing list