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

Chris Lattner clattner at apple.com
Thu Jun 23 09:30:13 PDT 2011


On Jun 23, 2011, at 9:16 AM, Anton Lokhmotov wrote:

> 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.

Sure, feel free to send in a patch that bumps it up to unsigned short.

-Chris



More information about the cfe-dev mailing list