From: Hartmut Kaiser Date: Sun, 23 Sep 2007 23:39:51 +0000 (+0000) Subject: Fixed VC++ bitfield to unsigned/signed sign propagation issue. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a8ae51f79d35b7c1822ba4a086176b4a8c862862;p=clang Fixed VC++ bitfield to unsigned/signed sign propagation issue. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42252 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h index d99babb4c1..7abc62e0ec 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -213,7 +213,7 @@ private: /// 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 @@ protected: 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(TC & 0xf); } + TypeClass getTypeClass() const { return static_cast(TC); } bool isCanonical() const { return CanonicalType.getTypePtr() == this; }