[cfe-dev] Bug Patch for MSVC

Cédric Venet cedric.venet at student.ecp.fr
Tue Sep 18 01:51:09 PDT 2007


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

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 {
-   enum TypeClass {
+   enum TypeClass : unsigned int {
      Builtin, Complex, Pointer, Reference,
      ConstantArray, VariableArray,
      Vector, OCUVector,
      FunctionNoProto, FunctionProto,
      TypeName, Tagged,
      TypeOfExp, TypeOfTyp // GNU typeof extension.
    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.

best regards,

Cédric Venet

More information about the cfe-dev mailing list