Skip to content

Commit 136c821

Browse files
authored
Merge pull request #20095 from slavapestov/fix-noassert-class-metadata-5.0
Runtime: Unconditionally realize superclass metadata in swift_updateClassMetadata() [5.0]
2 parents e28fe88 + 6afe8c1 commit 136c821

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

stdlib/public/runtime/Metadata.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2616,7 +2616,6 @@ swift::swift_updateClassMetadata(ClassMetadata *self,
26162616
size_t numFields,
26172617
const TypeLayout * const *fieldTypes,
26182618
size_t *fieldOffsets) {
2619-
#ifndef NDEBUG
26202619
// If there is a mangled superclass name, demangle it to the superclass
26212620
// type.
26222621
const ClassMetadata *super = nullptr;
@@ -2645,7 +2644,6 @@ swift::swift_updateClassMetadata(ClassMetadata *self,
26452644
assert(self->Superclass == getRootSuperclass());
26462645
else
26472646
assert(self->Superclass == super);
2648-
#endif
26492647

26502648
// FIXME: Plumb this through
26512649
#if 1

test/Interpreter/objc_class_resilience.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,15 @@ ResilientClassTestSuite.test("Category") {
3838
expectEqual(42, takesMyProtocol(ResilientFieldWithCategory()))
3939
}
4040

41+
// rdar://problem/45569020 - Make sure we initialize the superclass first
42+
class ResilientSuperclass {
43+
var value: ResilientInt?
44+
}
45+
46+
class ResilientSubclass : ResilientSuperclass {}
47+
48+
ResilientClassTestSuite.test("Superclass") {
49+
_blackHole(ResilientSubclass())
50+
}
51+
4152
runAllTests()

0 commit comments

Comments
 (0)