Commit Graph

1 Commits

Author SHA1 Message Date
Slava Pestov
36e46c054d IRGen: Fix DynamicSelfType metadata recovery in @objc convenience initializers
An @objc convenience initializer can replace 'self'. Since IRGen
has no way to tell what the new 'self' value is from looking at
SIL, it always refers back to the original 'self' argument when
recovering DynamicSelfType metadata. This could cause a crash
if the metadata was used after the 'self' value had been
replaced.

To fix the crash, always insert the metadata recovery into the
entry block, where the 'self' value should be valid (even if
uninitialized, the 'isa' pointer should be correct).

Fixes <rdar://problem/50594689>.
2019-05-13 23:11:11 -04:00