swift icon indicating copy to clipboard operation
swift copied to clipboard

Add type encodings to objcImpl ivars

Open beccadax opened this issue 9 months ago • 0 comments

When IRGen creates the ObjC ivars for a Swift class, it doesn’t include type encodings for them. This is perfectly alright, since the same fields are described in Swift metadata…unless you’re using @objc @implementation, which doesn’t have any Swift metadata. That sucks if you’re trying to, say, debug these classes.

Modify IRGen to add type encodings to the ivars for @objc @implementation classes. This is complicated by the fact that these ivars can contain Swift-only types, so invent an ObjC type encoding for Swift-only types that (a) makes them identifiable as Swift-only types, (b) has enough info for tools to figure out what the Swift type is and retrieve its metadata, and (c) still mostly works for consumers of ObjC type encodings that don’t know anything about Swift.

Fixes rdar://127448609.

beccadax avatar May 04 '24 06:05 beccadax