[cfe-commits] r42252 - /cfe/trunk/include/clang/AST/Type.h

Hartmut Kaiser hartmut.kaiser at gmail.com
Sun Sep 23 16:39:51 PDT 2007


Author: hkaiser
Date: Sun Sep 23 18:39:51 2007
New Revision: 42252

URL: http://llvm.org/viewvc/llvm-project?rev=42252&view=rev
Log:
Fixed VC++ bitfield to unsigned/signed sign propagation issue.

Modified:
    cfe/trunk/include/clang/AST/Type.h

Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=42252&r1=42251&r2=42252&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Sun Sep 23 18:39:51 2007
@@ -213,7 +213,7 @@
   /// 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;
+  unsigned TC : 4;
 protected:
   // silence VC++ warning C4355: 'this' : used in base member initializer list
   Type *this_() { return this; }
@@ -222,10 +222,7 @@
   virtual ~Type();
   friend class ASTContext;
 public:
-  // Masking the 4 bits from the bitfield above is necessary, since at least
-  // VC++ fills the unused bits of the word the bitfield is stored in with
-  // '1' resulting in invalid values returned from this function otherwise.
-  TypeClass getTypeClass() const { return static_cast<TypeClass>(TC & 0xf); }
+  TypeClass getTypeClass() const { return static_cast<TypeClass>(TC); }
   
   bool isCanonical() const { return CanonicalType.getTypePtr() == this; }
 





More information about the cfe-commits mailing list