Fixed a VC++ issue related to bitmasks. As it turns out the compiler fills the unused bits of the word a bitmask is stored in with '1' (or randomly, I can't tell, I've seen '1' so far only), which creates wrong results in certain cases.

Please review.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42061 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h
index 9c853e3..d99babb 100644
--- a/include/clang/AST/Type.h
+++ b/include/clang/AST/Type.h
@@ -222,7 +222,10 @@
   virtual ~Type();
   friend class ASTContext;
 public:
-  TypeClass getTypeClass() const { return TC; }
+  // 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); }
   
   bool isCanonical() const { return CanonicalType.getTypePtr() == this; }