[cfe-dev] Bug Patch for MSVC

Chris Lattner clattner at apple.com
Wed Sep 19 10:16:40 PDT 2007


On Sep 18, 2007, at 1:51 AM, Cédric Venet wrote:

>
>       Hi,
>
>    There is a small bug in the actual clang code when compiling with
> visual studio 8.0 . For VS, the enum are signed so when an enum is
> used in a bit field just the right size, it get sign exteded when you
> read it and this cause problems (here it perturb isa<> so clang can't
> compile a function definition...)

Ok.

> here is the patch (not a true patch since I don't have svn acces from
> where I am)
>
> file: /include/clang/AST/Type.h
> lines: 199 to 216
>
>   class Type {
>   public:
> -   enum TypeClass {
> +   enum TypeClass : unsigned int {

This isn't valid C++ Syntax.

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

-Chris



More information about the cfe-dev mailing list