@@ -5398,6 +5398,7 @@ diagnoseUnsupportedObjCImplLayout(IRGenModule &IGM, ClassDecl *classDecl,
53985398void irgen::emitClassMetadata (IRGenModule &IGM, ClassDecl *classDecl,
53995399 const ClassLayout &fragileLayout,
54005400 const ClassLayout &resilientLayout) {
5401+
54015402 assert (!classDecl->isForeign ());
54025403 PrettyStackTraceDecl stackTraceRAII (" emitting metadata for" , classDecl);
54035404
@@ -5565,8 +5566,7 @@ static void emitEmbeddedVTable(IRGenModule &IGM, CanType classTy,
55655566 (void )var;
55665567}
55675568
5568- void irgen::emitEmbeddedClassMetadata (IRGenModule &IGM, ClassDecl *classDecl,
5569- const ClassLayout &fragileLayout) {
5569+ void irgen::emitEmbeddedClassMetadata (IRGenModule &IGM, ClassDecl *classDecl) {
55705570 PrettyStackTraceDecl stackTraceRAII (" emitting metadata for" , classDecl);
55715571 assert (!classDecl->isForeign ());
55725572 CanType declaredType = classDecl->getDeclaredType ()->getCanonicalType ();
@@ -5578,7 +5578,9 @@ void irgen::emitLazyClassMetadata(IRGenModule &IGM, CanType classTy) {
55785578 // Might already be emitted, skip if that's the case.
55795579 auto entity =
55805580 LinkEntity::forTypeMetadata (classTy, TypeMetadataAddress::AddressPoint);
5581- if (IGM.Context .LangOpts .hasFeature (Feature::EmbeddedExistentials)) {
5581+
5582+ auto isEmbeddedWithExistentials = IGM.Context .LangOpts .hasFeature (Feature::EmbeddedExistentials);
5583+ if (isEmbeddedWithExistentials) {
55825584 entity = LinkEntity::forTypeMetadata (classTy, TypeMetadataAddress::FullMetadata);
55835585 }
55845586 auto *existingVar = cast<llvm::GlobalVariable>(
@@ -5587,6 +5589,11 @@ void irgen::emitLazyClassMetadata(IRGenModule &IGM, CanType classTy) {
55875589 return ;
55885590 }
55895591
5592+ if (isEmbeddedWithExistentials) {
5593+ emitEmbeddedClassMetadata (IGM, classTy->getClassOrBoundGenericClass ());
5594+ return ;
5595+ }
5596+
55905597 auto &context = classTy->getNominalOrBoundGenericNominal ()->getASTContext ();
55915598 PrettyStackTraceType stackTraceRAII (
55925599 context, " emitting lazy class metadata for" , classTy);
0 commit comments