mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Specifically, in order to generate runtime errors when we do not handle an enum appropriately, we form a metatype from the input of the switch. The problem is that by the time we get to the leaf of the emission tree where this metatype is created, the input of the switch may have already been consumed. This means creating the metatype could be a use after free. This patch fixes the problem by emitting the value_metatype after we emit the subject of the switch, but before we emit the switch itself. rdar://49562761
2.0 KiB
2.0 KiB