@@ -1728,6 +1728,9 @@ class SILBuilder {
1728
1728
EnumElementDecl *Element, SILType Ty,
1729
1729
ValueOwnershipKind forwardingOwnershipKind) {
1730
1730
ASSERT (isLoadableOrOpaque (Ty));
1731
+ // Assert that this works and does not crash.
1732
+ (void )getModule ().getCaseIndex (Element);
1733
+
1731
1734
return insert (new (getModule ())
1732
1735
EnumInst (getSILDebugLocation (Loc), Operand, Element, Ty,
1733
1736
forwardingOwnershipKind));
@@ -1751,6 +1754,9 @@ class SILBuilder {
1751
1754
SILValue Operand,
1752
1755
EnumElementDecl *Element,
1753
1756
SILType Ty) {
1757
+ // Assert that this works and does not crash.
1758
+ (void )getModule ().getCaseIndex (Element);
1759
+
1754
1760
return insert (new (getModule ()) InitEnumDataAddrInst (
1755
1761
getSILDebugLocation (Loc), Operand, Element, Ty));
1756
1762
}
@@ -1776,6 +1782,9 @@ class SILBuilder {
1776
1782
EnumElementDecl *Element, SILType Ty,
1777
1783
ValueOwnershipKind forwardingOwnershipKind) {
1778
1784
ASSERT (isLoadableOrOpaque (Ty));
1785
+ // Assert that this works and does not crash.
1786
+ (void )getModule ().getCaseIndex (Element);
1787
+
1779
1788
return insert (new (getModule ()) UncheckedEnumDataInst (
1780
1789
getSILDebugLocation (Loc), Operand, Element, Ty,
1781
1790
forwardingOwnershipKind));
@@ -1791,6 +1800,9 @@ class SILBuilder {
1791
1800
UncheckedTakeEnumDataAddrInst *
1792
1801
createUncheckedTakeEnumDataAddr (SILLocation Loc, SILValue Operand,
1793
1802
EnumElementDecl *Element, SILType Ty) {
1803
+ // Assert that this works and does not crash.
1804
+ (void )getModule ().getCaseIndex (Element);
1805
+
1794
1806
return insert (new (getModule ()) UncheckedTakeEnumDataAddrInst (
1795
1807
getSILDebugLocation (Loc), Operand, Element, Ty));
1796
1808
}
@@ -1805,6 +1817,9 @@ class SILBuilder {
1805
1817
1806
1818
InjectEnumAddrInst *createInjectEnumAddr (SILLocation Loc, SILValue Operand,
1807
1819
EnumElementDecl *Element) {
1820
+ // Assert that this works and does not crash.
1821
+ (void )getModule ().getCaseIndex (Element);
1822
+
1808
1823
return insert (new (getModule ()) InjectEnumAddrInst (
1809
1824
getSILDebugLocation (Loc), Operand, Element));
1810
1825
}
0 commit comments