Skip to content

Commit b54b82f

Browse files
authored
Merge pull request #65693 from al45tair/eng/PR-108882759
[Runtime] Print type names in escape-from-deinit messages.
2 parents af933b0 + 18a753c commit b54b82f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

stdlib/public/runtime/HeapObject.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -815,11 +815,16 @@ void swift::swift_deallocClassInstance(HeapObject *object,
815815
size_t allocatedSize,
816816
size_t allocatedAlignMask) {
817817
size_t retainCount = swift_retainCount(object);
818-
if (SWIFT_UNLIKELY(retainCount > 1))
818+
if (SWIFT_UNLIKELY(retainCount > 1)) {
819+
auto descriptor = object->metadata->getTypeContextDescriptor();
820+
819821
swift::fatalError(0,
820-
"Object %p deallocated with retain count %zd, reference "
821-
"may have escaped from deinit.\n",
822-
object, retainCount);
822+
"Object %p of class %s deallocated with retain count %zd, "
823+
"reference may have escaped from deinit.\n",
824+
object,
825+
descriptor ? descriptor->Name.get() : "<unknown>",
826+
retainCount);
827+
}
823828

824829
#if SWIFT_OBJC_INTEROP
825830
// We need to let the ObjC runtime clean up any associated objects or weak

0 commit comments

Comments
 (0)