Skip to content

Commit c20d085

Browse files
committed
RemoteAST: Fix Error existential introspection on Linux
We don't have tests that look at the instance address on the Swift side, but lldb is going to use this API shortly.
1 parent 71d0a67 commit c20d085

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

include/swift/Remote/MetadataReader.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,11 +410,15 @@ class MetadataReader {
410410
StoredPointer InstanceAddress =
411411
InstanceMetadataAddressAddress + 2 * sizeof(StoredPointer);
412412

413+
// When built with Objective-C interop, the runtime also stores a conformance
414+
// to Hashable and the base type introducing the Hashable conformance.
415+
if (isObjC)
416+
InstanceAddress += 2 * sizeof(StoredPointer);
417+
413418
// Round up to alignment, and we have the start address of the
414419
// instance payload.
415420
auto AlignmentMask = VWT->getAlignmentMask();
416-
auto Offset = (sizeof(HeapObject) + AlignmentMask) & ~AlignmentMask;
417-
InstanceAddress += Offset;
421+
InstanceAddress = (InstanceAddress + AlignmentMask) & ~AlignmentMask;
418422

419423
return RemoteExistential(
420424
RemoteAddress(*InstanceMetadataAddress),

0 commit comments

Comments
 (0)