mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
We were recovering metadata from generic boxes by reading the instantiated payload metadata from the box's metadata, but this approach doesn't work for fixed-size boxes, whose metadata does not store the payload metadata at all. Instead, emit a capture descriptor with no metadata sources and a single capture, using the lowered AST type appearing in the alloc_box instruction that emitted the box. Since box metadata is shared by all POD types of the same size, and all single-retainable pointer payloads, the AST type might not accurately reflect what is actually in the box. However, this type is *layout compatible* with the box payload, at least enough to know where the retainable pointers are, because after all IRGen uses this type to synthesize the destructor. Fixes <rdar://problem/26314060>.
65 KiB
65 KiB