@@ -965,48 +965,6 @@ namespace decls_block {
965
965
#include " DeclTypeRecordNodes.def"
966
966
};
967
967
968
- namespace detail {
969
- enum TypeRecords : uint16_t {
970
- #define TYPE (Id ) Id##_TYPE = decls_block::RecordKind::Id##_TYPE,
971
- #include " DeclTypeRecordNodes.def"
972
- };
973
-
974
- template <TypeRecords Record>
975
- class TypeRecordDispatch {};
976
-
977
- template <TypeRecords RecordCode, typename ...Ts>
978
- struct code { public: constexpr static TypeRecords value = RecordCode; };
979
-
980
- struct function_deserializer {
981
- static llvm::Expected<Type>
982
- deserialize (ModuleFile &MF, SmallVectorImpl<uint64_t > &scratch,
983
- StringRef blobData, bool isGeneric);
984
- };
985
-
986
- #define TYPE_LAYOUT_IMPL (LAYOUT, ...) \
987
- using LAYOUT = BCRecordLayout<__VA_ARGS__>; \
988
- template <> \
989
- class detail ::TypeRecordDispatch< \
990
- detail::code<detail::TypeRecords::__VA_ARGS__>::value> { \
991
- friend class swift ::ModuleFile; \
992
- static llvm::Expected<Type> \
993
- deserialize (ModuleFile &MF, \
994
- llvm::SmallVectorImpl<uint64_t > &scratch, \
995
- StringRef blobData); \
996
- }
997
- } // namespace detail
998
-
999
- // / This \c TYPE_LAYOUT(...) macro replaces the usual \c BCRecordLayout coding
1000
- // / structures below by enforcing structural checks for the definition of
1001
- // / deserialization members. If you forget to define a \c TYPE_LAYOUT(...) for a
1002
- // / \c TYPE(...) there will be a gnarly SFINAE error pointing at it in
1003
- // / DeclTypeRecordNodes.def.
1004
- // /
1005
- // / This macro pairs with \c DESERIALIZE_TYPE(...) in Deserialization.cpp such
1006
- // / that if you forget \c DESERIALIZE_TYPE(...) you will come up
1007
- // / with a linker error.
1008
- #define TYPE_LAYOUT (LAYOUT, ...) TYPE_LAYOUT_IMPL(LAYOUT, __VA_ARGS__)
1009
-
1010
968
using ClangTypeLayout = BCRecordLayout<
1011
969
CLANG_TYPE,
1012
970
BCArray<BCVBR<6 >>
@@ -1018,61 +976,60 @@ namespace decls_block {
1018
976
>;
1019
977
1020
978
// / A placeholder for invalid types
1021
- TYPE_LAYOUT ( ErrorTypeLayout,
979
+ using ErrorTypeLayout = BCRecordLayout<
1022
980
ERROR_TYPE,
1023
981
TypeIDField // original type (if any)
1024
- ) ;
982
+ > ;
1025
983
1026
- TYPE_LAYOUT ( BuiltinAliasTypeLayout,
984
+ using BuiltinAliasTypeLayout = BCRecordLayout<
1027
985
BUILTIN_ALIAS_TYPE,
1028
986
DeclIDField, // typealias decl
1029
987
TypeIDField // canonical type (a fallback)
1030
- ) ;
988
+ > ;
1031
989
1032
- TYPE_LAYOUT ( TypeAliasTypeLayout,
990
+ using TypeAliasTypeLayout = BCRecordLayout<
1033
991
NAME_ALIAS_TYPE,
1034
992
DeclIDField, // typealias decl
1035
993
TypeIDField, // parent type
1036
994
TypeIDField, // underlying type
1037
995
TypeIDField, // substituted type
1038
996
SubstitutionMapIDField // substitution map
1039
- ) ;
997
+ > ;
1040
998
1041
- TYPE_LAYOUT (GenericTypeParamTypeLayout,
1042
- GENERIC_TYPE_PARAM_TYPE,
999
+ using GenericTypeParamTypeLayout = BCRecordLayout<GENERIC_TYPE_PARAM_TYPE,
1043
1000
BCFixed<1 >, // type sequence?
1044
1001
DeclIDField, // generic type parameter decl or depth
1045
1002
BCVBR<4 > // index + 1, or zero if we have a generic type
1046
1003
// parameter decl
1047
- ) ;
1004
+ > ;
1048
1005
1049
- TYPE_LAYOUT ( DependentMemberTypeLayout,
1006
+ using DependentMemberTypeLayout = BCRecordLayout<
1050
1007
DEPENDENT_MEMBER_TYPE,
1051
1008
TypeIDField, // base type
1052
1009
DeclIDField // associated type decl
1053
- ) ;
1054
- TYPE_LAYOUT ( NominalTypeLayout,
1010
+ > ;
1011
+ using NominalTypeLayout = BCRecordLayout<
1055
1012
NOMINAL_TYPE,
1056
1013
DeclIDField, // decl
1057
1014
TypeIDField // parent
1058
- ) ;
1015
+ > ;
1059
1016
1060
- TYPE_LAYOUT ( ParenTypeLayout,
1017
+ using ParenTypeLayout = BCRecordLayout<
1061
1018
PAREN_TYPE,
1062
1019
TypeIDField // inner type
1063
- ) ;
1020
+ > ;
1064
1021
1065
- TYPE_LAYOUT ( TupleTypeLayout,
1022
+ using TupleTypeLayout = BCRecordLayout<
1066
1023
TUPLE_TYPE
1067
- ) ;
1024
+ > ;
1068
1025
1069
1026
using TupleTypeEltLayout = BCRecordLayout<
1070
1027
TUPLE_TYPE_ELT,
1071
1028
IdentifierIDField, // name
1072
1029
TypeIDField // type
1073
1030
>;
1074
1031
1075
- TYPE_LAYOUT ( FunctionTypeLayout,
1032
+ using FunctionTypeLayout = BCRecordLayout<
1076
1033
FUNCTION_TYPE,
1077
1034
TypeIDField, // output
1078
1035
FunctionTypeRepresentationField, // representation
@@ -1084,7 +1041,7 @@ namespace decls_block {
1084
1041
DifferentiabilityKindField, // differentiability kind
1085
1042
TypeIDField // global actor
1086
1043
// trailed by parameters
1087
- ) ;
1044
+ > ;
1088
1045
1089
1046
using FunctionParamLayout = BCRecordLayout<
1090
1047
FUNCTION_PARAM,
@@ -1100,69 +1057,69 @@ namespace decls_block {
1100
1057
BCFixed<1 > // compileTimeConst
1101
1058
>;
1102
1059
1103
- TYPE_LAYOUT ( MetatypeTypeLayout,
1060
+ using MetatypeTypeLayout = BCRecordLayout<
1104
1061
METATYPE_TYPE,
1105
1062
TypeIDField, // instance type
1106
1063
MetatypeRepresentationField // representation
1107
- ) ;
1064
+ > ;
1108
1065
1109
- TYPE_LAYOUT ( ExistentialMetatypeTypeLayout,
1066
+ using ExistentialMetatypeTypeLayout = BCRecordLayout<
1110
1067
EXISTENTIAL_METATYPE_TYPE,
1111
1068
TypeIDField, // instance type
1112
1069
MetatypeRepresentationField // representation
1113
- ) ;
1070
+ > ;
1114
1071
1115
- TYPE_LAYOUT ( PrimaryArchetypeTypeLayout,
1072
+ using PrimaryArchetypeTypeLayout = BCRecordLayout<
1116
1073
PRIMARY_ARCHETYPE_TYPE,
1117
1074
GenericSignatureIDField, // generic environment
1118
1075
TypeIDField // interface type
1119
- ) ;
1076
+ > ;
1120
1077
1121
- TYPE_LAYOUT ( OpenedArchetypeTypeLayout,
1078
+ using OpenedArchetypeTypeLayout = BCRecordLayout<
1122
1079
OPENED_ARCHETYPE_TYPE,
1123
1080
TypeIDField, // the existential type
1124
1081
TypeIDField, // the interface type
1125
1082
GenericSignatureIDField // generic signature
1126
- ) ;
1083
+ > ;
1127
1084
1128
- TYPE_LAYOUT ( OpaqueArchetypeTypeLayout,
1085
+ using OpaqueArchetypeTypeLayout = BCRecordLayout<
1129
1086
OPAQUE_ARCHETYPE_TYPE,
1130
1087
DeclIDField, // the opaque type decl
1131
1088
TypeIDField, // the interface type
1132
1089
SubstitutionMapIDField // the arguments
1133
- ) ;
1090
+ > ;
1134
1091
1135
- TYPE_LAYOUT ( SequenceArchetypeTypeLayout,
1092
+ using SequenceArchetypeTypeLayout = BCRecordLayout<
1136
1093
SEQUENCE_ARCHETYPE_TYPE,
1137
1094
GenericSignatureIDField, // generic environment
1138
1095
TypeIDField // interface type
1139
- ) ;
1096
+ > ;
1140
1097
1141
- TYPE_LAYOUT ( DynamicSelfTypeLayout,
1098
+ using DynamicSelfTypeLayout = BCRecordLayout<
1142
1099
DYNAMIC_SELF_TYPE,
1143
1100
TypeIDField // self type
1144
- ) ;
1101
+ > ;
1145
1102
1146
- TYPE_LAYOUT ( ProtocolCompositionTypeLayout,
1103
+ using ProtocolCompositionTypeLayout = BCRecordLayout<
1147
1104
PROTOCOL_COMPOSITION_TYPE,
1148
1105
BCFixed<1 >, // has AnyObject constraint
1149
1106
BCArray<TypeIDField> // protocols
1150
- ) ;
1107
+ > ;
1151
1108
1152
- TYPE_LAYOUT ( ParameterizedProtocolTypeLayout,
1109
+ using ParameterizedProtocolTypeLayout = BCRecordLayout<
1153
1110
PARAMETERIZED_PROTOCOL_TYPE,
1154
1111
TypeIDField, // base
1155
1112
BCArray<TypeIDField> // arguments
1156
- ) ;
1113
+ > ;
1157
1114
1158
- TYPE_LAYOUT ( BoundGenericTypeLayout,
1115
+ using BoundGenericTypeLayout = BCRecordLayout<
1159
1116
BOUND_GENERIC_TYPE,
1160
1117
DeclIDField, // generic decl
1161
1118
TypeIDField, // parent
1162
1119
BCArray<TypeIDField> // generic arguments
1163
- ) ;
1120
+ > ;
1164
1121
1165
- TYPE_LAYOUT ( GenericFunctionTypeLayout,
1122
+ using GenericFunctionTypeLayout = BCRecordLayout<
1166
1123
GENERIC_FUNCTION_TYPE,
1167
1124
TypeIDField, // output
1168
1125
FunctionTypeRepresentationField, // representation
@@ -1171,12 +1128,12 @@ namespace decls_block {
1171
1128
BCFixed<1 >, // throws?
1172
1129
DifferentiabilityKindField, // differentiability kind
1173
1130
TypeIDField, // global actor
1174
- GenericSignatureIDField // generic signature
1131
+ GenericSignatureIDField // generic signture
1175
1132
1176
1133
// trailed by parameters
1177
- ) ;
1134
+ > ;
1178
1135
1179
- TYPE_LAYOUT ( SILFunctionTypeLayout,
1136
+ using SILFunctionTypeLayout = BCRecordLayout<
1180
1137
SIL_FUNCTION_TYPE,
1181
1138
BCFixed<1 >, // concurrent?
1182
1139
BCFixed<1 >, // async?
@@ -1199,57 +1156,55 @@ namespace decls_block {
1199
1156
// followed by error result type/convention
1200
1157
// Optionally a protocol conformance (for witness_methods)
1201
1158
// Optionally a substitution map (for substituted function types)
1202
- ) ;
1159
+ > ;
1203
1160
1204
- TYPE_LAYOUT ( SILBlockStorageTypeLayout,
1161
+ using SILBlockStorageTypeLayout = BCRecordLayout<
1205
1162
SIL_BLOCK_STORAGE_TYPE,
1206
1163
TypeIDField // capture type
1207
- );
1208
-
1209
- TYPE_LAYOUT (SILMoveOnlyTypeLayout,
1210
- SIL_MOVE_ONLY_TYPE,
1211
- TypeIDField // inner type
1212
- );
1164
+ >;
1213
1165
1214
1166
using SILLayoutLayout = BCRecordLayout<
1215
1167
SIL_LAYOUT,
1216
1168
GenericSignatureIDField, // generic signature
1217
- BCFixed<1 >, // captures generic env
1218
1169
BCVBR<8 >, // number of fields
1219
1170
BCArray<TypeIDWithBitField> // field types with mutability
1220
1171
>;
1221
1172
1222
- TYPE_LAYOUT ( SILBoxTypeLayout,
1173
+ using SILBoxTypeLayout = BCRecordLayout<
1223
1174
SIL_BOX_TYPE,
1224
1175
SILLayoutIDField, // layout
1225
1176
SubstitutionMapIDField // substitutions
1226
- ) ;
1177
+ > ;
1227
1178
1228
- #define SYNTAX_SUGAR_TYPE_LAYOUT (LAYOUT, CODE ) \
1229
- TYPE_LAYOUT (LAYOUT, CODE, TypeIDField)
1179
+ template <unsigned Code>
1180
+ using SyntaxSugarTypeLayout = BCRecordLayout<
1181
+ Code,
1182
+ TypeIDField // element type
1183
+ >;
1230
1184
1231
- SYNTAX_SUGAR_TYPE_LAYOUT (ArraySliceTypeLayout, ARRAY_SLICE_TYPE);
1232
- SYNTAX_SUGAR_TYPE_LAYOUT (OptionalTypeLayout, OPTIONAL_TYPE);
1233
- SYNTAX_SUGAR_TYPE_LAYOUT (VariadicSequenceTypeLayout, VARIADIC_SEQUENCE_TYPE);
1234
- SYNTAX_SUGAR_TYPE_LAYOUT (ExistentialTypeLayout, EXISTENTIAL_TYPE);
1185
+ using ArraySliceTypeLayout = SyntaxSugarTypeLayout<ARRAY_SLICE_TYPE>;
1186
+ using OptionalTypeLayout = SyntaxSugarTypeLayout<OPTIONAL_TYPE>;
1187
+ using VariadicSequenceTypeLayout = SyntaxSugarTypeLayout<VARIADIC_SEQUENCE_TYPE>;
1188
+ using ExistentialTypeLayout =
1189
+ SyntaxSugarTypeLayout<EXISTENTIAL_TYPE>;
1235
1190
1236
- TYPE_LAYOUT ( DictionaryTypeLayout,
1191
+ using DictionaryTypeLayout = BCRecordLayout<
1237
1192
DICTIONARY_TYPE,
1238
1193
TypeIDField, // key type
1239
1194
TypeIDField // value type
1240
- ) ;
1195
+ > ;
1241
1196
1242
- TYPE_LAYOUT ( ReferenceStorageTypeLayout,
1197
+ using ReferenceStorageTypeLayout = BCRecordLayout<
1243
1198
REFERENCE_STORAGE_TYPE,
1244
1199
ReferenceOwnershipField, // ownership
1245
1200
TypeIDField // implementation type
1246
- ) ;
1201
+ > ;
1247
1202
1248
- TYPE_LAYOUT ( UnboundGenericTypeLayout,
1203
+ using UnboundGenericTypeLayout = BCRecordLayout<
1249
1204
UNBOUND_GENERIC_TYPE,
1250
1205
DeclIDField, // generic decl
1251
1206
TypeIDField // parent
1252
- ) ;
1207
+ > ;
1253
1208
1254
1209
using TypeAliasLayout = BCRecordLayout<
1255
1210
TYPE_ALIAS_DECL,
@@ -1655,8 +1610,7 @@ namespace decls_block {
1655
1610
1656
1611
using AnyPatternLayout = BCRecordLayout<
1657
1612
ANY_PATTERN,
1658
- TypeIDField, // type
1659
- BCFixed<1 > // isAsyncLet
1613
+ TypeIDField // type
1660
1614
// FIXME: is the type necessary?
1661
1615
>;
1662
1616
@@ -2086,10 +2040,6 @@ namespace decls_block {
2086
2040
BC_AVAIL_TUPLE, // OS version
2087
2041
BCVBR<5 > // platform
2088
2042
>;
2089
-
2090
- #undef SYNTAX_SUGAR_TYPE_LAYOUT
2091
- #undef TYPE_LAYOUT
2092
- #undef TYPE_LAYOUT_IMPL
2093
2043
}
2094
2044
2095
2045
// / Returns the encoding kind for the given decl.
0 commit comments