[cfe-dev] Bug Patch for MSVC

Chris Lattner clattner at apple.com
Wed Sep 19 11:49:19 PDT 2007


On Sep 19, 2007, at 11:38 AM, Hartmut Kaiser wrote:

> Chris,
>
>>>     QualType CanonicalType;
>>>
>>>    /// TypeClass bitfield - Enum that specifies what subclass this
>>> belongs to.
>>>    /// Note that this should stay at the end of the ivars
>> for Type so
>>> that
>>>    /// subclasses can pack their bitfields into the same word.
>>>    TypeClass TC : 4;
>>>
>>> another alternative is to make the TC bit field 5 bits
>> wide. This is
>>> the choice llvm made in one of is class.
>>
>> I'd suggest changing getTypeClass() to do the appropriate masking.
>
> FWIW, that's exactly what I did a couple of days ago.
> Are there other places in clang where bitmasks are used?

The specific sticking issue seems to be enum bitfields.  The other  
solution would be to declare TC as:

  unsigned TC : 4;

and then return (TypeClass)TC;  in getTypeClass().  This is probably  
the cleanest solution.

-Chris




More information about the cfe-dev mailing list