@@ -899,6 +899,15 @@ class Type {
899
899
unsigned InnerRef : 1 ;
900
900
};
901
901
902
+ class TypeWithKeywordBitfields {
903
+ friend class TypeWithKeyword ;
904
+
905
+ unsigned : NumTypeBits;
906
+
907
+ // / An ElaboratedTypeKeyword. 8 bits for efficient access.
908
+ unsigned Keyword : 8 ;
909
+ };
910
+
902
911
class VectorTypeBitfields {
903
912
friend class VectorType ;
904
913
@@ -919,6 +928,7 @@ class Type {
919
928
FunctionTypeBitfields FunctionTypeBits;
920
929
ObjCObjectTypeBitfields ObjCObjectTypeBits;
921
930
ReferenceTypeBitfields ReferenceTypeBits;
931
+ TypeWithKeywordBitfields TypeWithKeywordBits;
922
932
VectorTypeBitfields VectorTypeBits;
923
933
};
924
934
@@ -2486,20 +2496,20 @@ class EnumType : public TagType {
2486
2496
2487
2497
class TemplateTypeParmType : public Type , public llvm ::FoldingSetNode {
2488
2498
unsigned Depth : 15 ;
2489
- unsigned Index : 16 ;
2490
2499
unsigned ParameterPack : 1 ;
2500
+ unsigned Index : 16 ;
2491
2501
IdentifierInfo *Name;
2492
2502
2493
2503
TemplateTypeParmType (unsigned D, unsigned I, bool PP, IdentifierInfo *N,
2494
2504
QualType Canon)
2495
2505
: Type(TemplateTypeParm, Canon, /* Dependent=*/ true ,
2496
2506
/* VariablyModified=*/ false ),
2497
- Depth (D), Index(I ), ParameterPack(PP ), Name(N) { }
2507
+ Depth (D), ParameterPack(PP ), Index(I ), Name(N) { }
2498
2508
2499
2509
TemplateTypeParmType (unsigned D, unsigned I, bool PP)
2500
2510
: Type(TemplateTypeParm, QualType(this , 0 ), /* Dependent=*/ true,
2501
2511
/* VariablyModified=*/ false),
2502
- Depth(D), Index(I ), ParameterPack(PP ), Name(0 ) { }
2512
+ Depth(D), ParameterPack(PP ), Index(I ), Name(0 ) { }
2503
2513
2504
2514
friend class ASTContext ; // ASTContext creates these
2505
2515
@@ -2778,20 +2788,18 @@ enum ElaboratedTypeKeyword {
2778
2788
// / Also provides a few static helpers for converting and printing
2779
2789
// / elaborated type keyword and tag type kind enumerations.
2780
2790
class TypeWithKeyword : public Type {
2781
- // / Keyword - Encodes an ElaboratedTypeKeyword enumeration constant.
2782
- unsigned Keyword : 3 ;
2783
-
2784
2791
protected:
2785
2792
TypeWithKeyword (ElaboratedTypeKeyword Keyword, TypeClass tc,
2786
2793
QualType Canonical, bool Dependent, bool VariablyModified)
2787
- : Type(tc, Canonical, Dependent, VariablyModified),
2788
- Keyword (Keyword) {}
2794
+ : Type(tc, Canonical, Dependent, VariablyModified) {
2795
+ TypeWithKeywordBits.Keyword = Keyword;
2796
+ }
2789
2797
2790
2798
public:
2791
2799
virtual ~TypeWithKeyword (); // pin vtable to Type.cpp
2792
2800
2793
2801
ElaboratedTypeKeyword getKeyword () const {
2794
- return static_cast <ElaboratedTypeKeyword>(Keyword);
2802
+ return static_cast <ElaboratedTypeKeyword>(TypeWithKeywordBits. Keyword );
2795
2803
}
2796
2804
2797
2805
// / getKeywordForTypeSpec - Converts a type specifier (DeclSpec::TST)
0 commit comments