Skip to content

Commit 139006c

Browse files
committed
Extract the TypeClass <-> TypeCode map into a .def file; NFC.
1 parent f6da0cf commit 139006c

File tree

2 files changed

+67
-142
lines changed

2 files changed

+67
-142
lines changed

clang/include/clang/Serialization/ASTBitCodes.h

Lines changed: 5 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,149 +1040,12 @@ namespace serialization {
10401040
/// constant describes a record for a specific type class in the
10411041
/// AST. Note that DeclCode values share this code space.
10421042
enum TypeCode {
1043-
/// An ExtQualType record.
1044-
TYPE_EXT_QUAL = 1,
1045-
1046-
/// A ComplexType record.
1047-
TYPE_COMPLEX = 3,
1048-
1049-
/// A PointerType record.
1050-
TYPE_POINTER = 4,
1051-
1052-
/// A BlockPointerType record.
1053-
TYPE_BLOCK_POINTER = 5,
1054-
1055-
/// An LValueReferenceType record.
1056-
TYPE_LVALUE_REFERENCE = 6,
1057-
1058-
/// An RValueReferenceType record.
1059-
TYPE_RVALUE_REFERENCE = 7,
1060-
1061-
/// A MemberPointerType record.
1062-
TYPE_MEMBER_POINTER = 8,
1063-
1064-
/// A ConstantArrayType record.
1065-
TYPE_CONSTANT_ARRAY = 9,
1066-
1067-
/// An IncompleteArrayType record.
1068-
TYPE_INCOMPLETE_ARRAY = 10,
1069-
1070-
/// A VariableArrayType record.
1071-
TYPE_VARIABLE_ARRAY = 11,
1072-
1073-
/// A VectorType record.
1074-
TYPE_VECTOR = 12,
1075-
1076-
/// An ExtVectorType record.
1077-
TYPE_EXT_VECTOR = 13,
1078-
1079-
/// A FunctionNoProtoType record.
1080-
TYPE_FUNCTION_NO_PROTO = 14,
1081-
1082-
/// A FunctionProtoType record.
1083-
TYPE_FUNCTION_PROTO = 15,
1084-
1085-
/// A TypedefType record.
1086-
TYPE_TYPEDEF = 16,
1087-
1088-
/// A TypeOfExprType record.
1089-
TYPE_TYPEOF_EXPR = 17,
1090-
1091-
/// A TypeOfType record.
1092-
TYPE_TYPEOF = 18,
1093-
1094-
/// A RecordType record.
1095-
TYPE_RECORD = 19,
1096-
1097-
/// An EnumType record.
1098-
TYPE_ENUM = 20,
1099-
1100-
/// An ObjCInterfaceType record.
1101-
TYPE_OBJC_INTERFACE = 21,
1102-
1103-
/// An ObjCObjectPointerType record.
1104-
TYPE_OBJC_OBJECT_POINTER = 22,
1105-
1106-
/// a DecltypeType record.
1107-
TYPE_DECLTYPE = 23,
1108-
1109-
/// An ElaboratedType record.
1110-
TYPE_ELABORATED = 24,
1111-
1112-
/// A SubstTemplateTypeParmType record.
1113-
TYPE_SUBST_TEMPLATE_TYPE_PARM = 25,
1043+
#define TYPE_BIT_CODE(CLASS_ID, CODE_ID, CODE_VALUE) \
1044+
TYPE_##CODE_ID = CODE_VALUE,
1045+
#include "clang/Serialization/TypeBitCodes.def"
11141046

1115-
/// An UnresolvedUsingType record.
1116-
TYPE_UNRESOLVED_USING = 26,
1117-
1118-
/// An InjectedClassNameType record.
1119-
TYPE_INJECTED_CLASS_NAME = 27,
1120-
1121-
/// An ObjCObjectType record.
1122-
TYPE_OBJC_OBJECT = 28,
1123-
1124-
/// An TemplateTypeParmType record.
1125-
TYPE_TEMPLATE_TYPE_PARM = 29,
1126-
1127-
/// An TemplateSpecializationType record.
1128-
TYPE_TEMPLATE_SPECIALIZATION = 30,
1129-
1130-
/// A DependentNameType record.
1131-
TYPE_DEPENDENT_NAME = 31,
1132-
1133-
/// A DependentTemplateSpecializationType record.
1134-
TYPE_DEPENDENT_TEMPLATE_SPECIALIZATION = 32,
1135-
1136-
/// A DependentSizedArrayType record.
1137-
TYPE_DEPENDENT_SIZED_ARRAY = 33,
1138-
1139-
/// A ParenType record.
1140-
TYPE_PAREN = 34,
1141-
1142-
/// A PackExpansionType record.
1143-
TYPE_PACK_EXPANSION = 35,
1144-
1145-
/// An AttributedType record.
1146-
TYPE_ATTRIBUTED = 36,
1147-
1148-
/// A SubstTemplateTypeParmPackType record.
1149-
TYPE_SUBST_TEMPLATE_TYPE_PARM_PACK = 37,
1150-
1151-
/// A AutoType record.
1152-
TYPE_AUTO = 38,
1153-
1154-
/// A UnaryTransformType record.
1155-
TYPE_UNARY_TRANSFORM = 39,
1156-
1157-
/// An AtomicType record.
1158-
TYPE_ATOMIC = 40,
1159-
1160-
/// A DecayedType record.
1161-
TYPE_DECAYED = 41,
1162-
1163-
/// An AdjustedType record.
1164-
TYPE_ADJUSTED = 42,
1165-
1166-
/// A PipeType record.
1167-
TYPE_PIPE = 43,
1168-
1169-
/// An ObjCTypeParamType record.
1170-
TYPE_OBJC_TYPE_PARAM = 44,
1171-
1172-
/// A DeducedTemplateSpecializationType record.
1173-
TYPE_DEDUCED_TEMPLATE_SPECIALIZATION = 45,
1174-
1175-
/// A DependentSizedExtVectorType record.
1176-
TYPE_DEPENDENT_SIZED_EXT_VECTOR = 46,
1177-
1178-
/// A DependentAddressSpaceType record.
1179-
TYPE_DEPENDENT_ADDRESS_SPACE = 47,
1180-
1181-
/// A dependentSizedVectorType record.
1182-
TYPE_DEPENDENT_SIZED_VECTOR = 48,
1183-
1184-
/// A type defined in a macro.
1185-
TYPE_MACRO_QUALIFIED = 49
1047+
/// An ExtQualType record.
1048+
TYPE_EXT_QUAL = 1
11861049
};
11871050

11881051
/// The type IDs for special types constructed by semantic
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
//===--- TypeNodeBitCodes.def - Type to bitcode correspondance --*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// This file provides an x-macro link between AST Type IDs and
10+
// their stable serialized bit-code record type IDs.
11+
//
12+
//===----------------------------------------------------------------------===//
13+
14+
TYPE_BIT_CODE(Complex, COMPLEX, 3)
15+
TYPE_BIT_CODE(Pointer, POINTER, 4)
16+
TYPE_BIT_CODE(BlockPointer, BLOCK_POINTER, 5)
17+
TYPE_BIT_CODE(LValueReference, LVALUE_REFERENCE, 6)
18+
TYPE_BIT_CODE(RValueReference, RVALUE_REFERENCE, 7)
19+
TYPE_BIT_CODE(MemberPointer, MEMBER_POINTER, 8)
20+
TYPE_BIT_CODE(ConstantArray, CONSTANT_ARRAY, 9)
21+
TYPE_BIT_CODE(IncompleteArray, INCOMPLETE_ARRAY, 10)
22+
TYPE_BIT_CODE(VariableArray, VARIABLE_ARRAY, 11)
23+
TYPE_BIT_CODE(Vector, VECTOR, 12)
24+
TYPE_BIT_CODE(ExtVector, EXT_VECTOR, 13)
25+
TYPE_BIT_CODE(FunctionNoProto, FUNCTION_NO_PROTO, 14)
26+
TYPE_BIT_CODE(FunctionProto, FUNCTION_PROTO, 15)
27+
TYPE_BIT_CODE(Typedef, TYPEDEF, 16)
28+
TYPE_BIT_CODE(TypeOfExpr, TYPEOF_EXPR, 17)
29+
TYPE_BIT_CODE(TypeOf, TYPEOF, 18)
30+
TYPE_BIT_CODE(Record, RECORD, 19)
31+
TYPE_BIT_CODE(Enum, ENUM, 20)
32+
TYPE_BIT_CODE(ObjCInterface, OBJC_INTERFACE, 21)
33+
TYPE_BIT_CODE(ObjCObjectPointer, OBJC_OBJECT_POINTER, 22)
34+
TYPE_BIT_CODE(Decltype, DECLTYPE, 23)
35+
TYPE_BIT_CODE(Elaborated, ELABORATED, 24)
36+
TYPE_BIT_CODE(SubstTemplateTypeParm, SUBST_TEMPLATE_TYPE_PARM, 25)
37+
TYPE_BIT_CODE(UnresolvedUsing, UNRESOLVED_USING, 26)
38+
TYPE_BIT_CODE(InjectedClassName, INJECTED_CLASS_NAME, 27)
39+
TYPE_BIT_CODE(ObjCObject, OBJC_OBJECT, 28)
40+
TYPE_BIT_CODE(TemplateTypeParm, TEMPLATE_TYPE_PARM, 29)
41+
TYPE_BIT_CODE(TemplateSpecialization, TEMPLATE_SPECIALIZATION, 30)
42+
TYPE_BIT_CODE(DependentName, DEPENDENT_NAME, 31)
43+
TYPE_BIT_CODE(DependentTemplateSpecialization, DEPENDENT_TEMPLATE_SPECIALIZATION, 32)
44+
TYPE_BIT_CODE(DependentSizedArray, DEPENDENT_SIZED_ARRAY, 33)
45+
TYPE_BIT_CODE(Paren, PAREN, 34)
46+
TYPE_BIT_CODE(PackExpansion, PACK_EXPANSION, 35)
47+
TYPE_BIT_CODE(Attributed, ATTRIBUTED, 36)
48+
TYPE_BIT_CODE(SubstTemplateTypeParmPack, SUBST_TEMPLATE_TYPE_PARM_PACK, 37)
49+
TYPE_BIT_CODE(Auto, AUTO, 38)
50+
TYPE_BIT_CODE(UnaryTransform, UNARY_TRANSFORM, 39)
51+
TYPE_BIT_CODE(Atomic, ATOMIC, 40)
52+
TYPE_BIT_CODE(Decayed, DECAYED, 41)
53+
TYPE_BIT_CODE(Adjusted, ADJUSTED, 42)
54+
TYPE_BIT_CODE(Pipe, PIPE, 43)
55+
TYPE_BIT_CODE(ObjCTypeParam, OBJC_TYPE_PARAM, 44)
56+
TYPE_BIT_CODE(DeducedTemplateSpecialization, DEDUCED_TEMPLATE_SPECIALIZATION, 45)
57+
TYPE_BIT_CODE(DependentSizedExtVector, DEPENDENT_SIZED_EXT_VECTOR, 46)
58+
TYPE_BIT_CODE(DependentAddressSpace, DEPENDENT_ADDRESS_SPACE, 47)
59+
TYPE_BIT_CODE(DependentVector, DEPENDENT_SIZED_VECTOR, 48)
60+
TYPE_BIT_CODE(MacroQualified, MACRO_QUALIFIED, 49)
61+
62+
#undef TYPE_BIT_CODE

0 commit comments

Comments
 (0)