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. llvm-svn: 42061
This commit is contained in:
parent
39d641f526
commit
f696cfcf06
|
@ -222,7 +222,10 @@ protected:
|
|||
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; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue