@@ -3949,6 +3949,12 @@ namespace {
39493949 }
39503950
39513951 void addDestructorFunction () {
3952+ if (IGM.Context .LangOpts .hasFeature (Feature::Embedded)) {
3953+ auto dtorRef = SILDeclRef (Target->getDestructor (), SILDeclRef::Kind::Deallocator);
3954+ addReifiedVTableEntry (dtorRef);
3955+ return ;
3956+ }
3957+
39523958 if (asImpl ().getFieldLayout ().hasObjCImplementation ())
39533959 return ;
39543960
@@ -4967,6 +4973,36 @@ void irgen::emitClassMetadata(IRGenModule &IGM, ClassDecl *classDecl,
49674973 }
49684974}
49694975
4976+ void irgen::emitEmbeddedClassMetadata (IRGenModule &IGM, ClassDecl *classDecl,
4977+ const ClassLayout &fragileLayout) {
4978+ PrettyStackTraceDecl stackTraceRAII (" emitting metadata for" , classDecl);
4979+ assert (!classDecl->isForeign ());
4980+
4981+ // Set up a dummy global to stand in for the metadata object while we produce
4982+ // relative references.
4983+ ConstantInitBuilder builder (IGM);
4984+ auto init = builder.beginStruct ();
4985+ init.setPacked (true );
4986+
4987+ auto strategy = IGM.getClassMetadataStrategy (classDecl);
4988+ assert (strategy == ClassMetadataStrategy::FixedOrUpdate ||
4989+ strategy == ClassMetadataStrategy::Fixed);
4990+
4991+ FixedClassMetadataBuilder metadataBuilder (IGM, classDecl, init,
4992+ fragileLayout);
4993+ metadataBuilder.layout ();
4994+ bool canBeConstant = metadataBuilder.canBeConstant ();
4995+ metadataBuilder.createMetadataAccessFunction ();
4996+
4997+ CanType declaredType = classDecl->getDeclaredType ()->getCanonicalType ();
4998+
4999+ StringRef section{};
5000+ bool isPattern = false ;
5001+ auto var = IGM.defineTypeMetadata (declaredType, isPattern, canBeConstant,
5002+ init.finishAndCreateFuture (), section);
5003+ (void )var;
5004+ }
5005+
49705006void irgen::emitSpecializedGenericClassMetadata (IRGenModule &IGM, CanType type,
49715007 ClassDecl &decl) {
49725008 assert (decl.isGenericContext ());
0 commit comments