Skip to content

Commit aa77f6e

Browse files
committed
IRGen: Emit reference to class stub from class context descriptor
This was an oversight. I was setting the flag but not emitting the pointer at the end.
1 parent 91d0a10 commit aa77f6e

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

lib/IRGen/GenMeta.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,6 +1399,7 @@ namespace {
13991399
super::layout();
14001400
addVTable();
14011401
addOverrideTable();
1402+
addObjCResilientClassStubInfo();
14021403
}
14031404

14041405
void addIncompleteMetadataOrRelocationFunction() {
@@ -1632,6 +1633,20 @@ namespace {
16321633
// uint32_t FieldOffsetVectorOffset;
16331634
B.addInt32(getFieldVectorOffset() / IGM.getPointerSize());
16341635
}
1636+
1637+
void addObjCResilientClassStubInfo() {
1638+
if (IGM.getClassMetadataStrategy(getType()) !=
1639+
ClassMetadataStrategy::Resilient)
1640+
return;
1641+
1642+
if (!hasObjCResilientClassStub(IGM, getType()))
1643+
return;
1644+
1645+
B.addRelativeAddress(
1646+
IGM.getAddrOfObjCResilientClassStub(
1647+
getType(), NotForDefinition,
1648+
TypeMetadataAddress::AddressPoint));
1649+
}
16351650
};
16361651

16371652
class OpaqueTypeDescriptorBuilder

test/IRGen/class_update_callback_with_stub.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ import resilient_objc_class
5151
// CHECK-SAME: @"got.$s15resilient_class22ResilientOutsideParentCMn"
5252
// CHECK-SAME: @"got.$s15resilient_class22ResilientOutsideParentCACycfCTq"
5353
// CHECK-SAME: @"$s31class_update_callback_with_stub17ResilientSubclassCACycfC"
54+
// -- class stub
55+
// CHECK-SAME: @"$s31class_update_callback_with_stub17ResilientSubclassCMt"
5456
// CHECK-SAME: }>, section "__TEXT,__const", align 4
5557

5658

0 commit comments

Comments
 (0)