@@ -202,21 +202,16 @@ class ReflectionMetadataBuilder {
202
202
if (IGM.getSwiftModule ()->isStdlibModule () && isa<BuiltinType>(t))
203
203
IGM.BuiltinTypes .insert (t);
204
204
205
- // We need size/alignment information for imported value types,
206
- // so emit builtin descriptors for them.
205
+ // We need size/alignment information for imported structs and
206
+ // enums, so emit builtin descriptors for them.
207
207
//
208
208
// In effect they're treated like an opaque blob, which is OK
209
209
// for now, at least until we want to import C++ types or
210
210
// something like that.
211
- //
212
- // Classes and protocols go down a different path.
213
211
if (auto Nominal = t->getAnyNominal ())
214
212
if (Nominal->hasClangNode ()) {
215
- if (auto CD = dyn_cast<ClassDecl>(Nominal))
216
- IGM.ImportedClasses .insert (CD);
217
- else if (auto PD = dyn_cast<ProtocolDecl>(Nominal))
218
- IGM.ImportedProtocols .insert (PD);
219
- else
213
+ if (isa<StructDecl>(Nominal) ||
214
+ isa<EnumDecl>(Nominal))
220
215
IGM.OpaqueTypes .insert (Nominal);
221
216
}
222
217
});
@@ -386,14 +381,6 @@ class FieldTypeMetadataBuilder : public ReflectionMetadataBuilder {
386
381
B.addInt16 (uint16_t (kind));
387
382
B.addInt16 (fieldRecordSize);
388
383
389
- // Imported classes don't need field descriptors
390
- if (NTD->hasClangNode () && isa<ClassDecl>(NTD)) {
391
- B.addInt32 (0 );
392
- return ;
393
- }
394
-
395
- assert (!NTD->hasClangNode () || isa<StructDecl>(NTD));
396
-
397
384
auto properties = NTD->getStoredProperties ();
398
385
B.addInt32 (std::distance (properties.begin (), properties.end ()));
399
386
for (auto property : properties)
@@ -453,11 +440,7 @@ class FieldTypeMetadataBuilder : public ReflectionMetadataBuilder {
453
440
}
454
441
455
442
void layout () override {
456
- if (NTD->hasClangNode () &&
457
- !isa<ClassDecl>(NTD) &&
458
- !isa<StructDecl>(NTD) &&
459
- !isa<ProtocolDecl>(NTD))
460
- return ;
443
+ assert (!NTD->hasClangNode () || isa<StructDecl>(NTD));
461
444
462
445
PrettyStackTraceDecl DebugStack (" emitting field type metadata" , NTD);
463
446
addNominalRef (NTD);
@@ -949,12 +932,6 @@ void IRGenModule::emitBuiltinReflectionMetadata() {
949
932
BuiltinTypes.insert (anyMetatype);
950
933
}
951
934
952
- for (auto CD : ImportedClasses)
953
- emitFieldMetadataRecord (CD);
954
-
955
- for (auto PD : ImportedProtocols)
956
- emitFieldMetadataRecord (PD);
957
-
958
935
for (auto SD : ImportedStructs)
959
936
emitFieldMetadataRecord (SD);
960
937
0 commit comments