Fixed VC++ bitfield to unsigned/signed sign propagation issue.
llvm-svn: 42252
This commit is contained in:
		
							parent
							
								
									15efb43db7
								
							
						
					
					
						commit
						e675ff918b
					
				| 
						 | 
					@ -213,7 +213,7 @@ private:
 | 
				
			||||||
  /// TypeClass bitfield - Enum that specifies what subclass this belongs to.
 | 
					  /// 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
 | 
					  /// Note that this should stay at the end of the ivars for Type so that
 | 
				
			||||||
  /// subclasses can pack their bitfields into the same word.
 | 
					  /// subclasses can pack their bitfields into the same word.
 | 
				
			||||||
  TypeClass TC : 4;
 | 
					  unsigned TC : 4;
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
  // silence VC++ warning C4355: 'this' : used in base member initializer list
 | 
					  // silence VC++ warning C4355: 'this' : used in base member initializer list
 | 
				
			||||||
  Type *this_() { return this; }
 | 
					  Type *this_() { return this; }
 | 
				
			||||||
| 
						 | 
					@ -222,10 +222,7 @@ protected:
 | 
				
			||||||
  virtual ~Type();
 | 
					  virtual ~Type();
 | 
				
			||||||
  friend class ASTContext;
 | 
					  friend class ASTContext;
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  // Masking the 4 bits from the bitfield above is necessary, since at least
 | 
					  TypeClass getTypeClass() const { return static_cast<TypeClass>(TC); }
 | 
				
			||||||
  // 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; }
 | 
					  bool isCanonical() const { return CanonicalType.getTypePtr() == this; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue