@@ -1652,13 +1652,27 @@ SwiftInt BridgedInstruction::TypeValueInst_getValue() const {
1652
1652
// VarDeclInst and DebugVariableInst
1653
1653
// ===----------------------------------------------------------------------===//
1654
1654
1655
- static_assert (sizeof (std::optional< swift::SILDebugVariable> ) <= sizeof(OptionalBridgedSILDebugVariable ));
1655
+ static_assert (sizeof (swift::SILDebugVariable) <= sizeof(BridgedSILDebugVariable ));
1656
1656
1657
- static inline
1658
- OptionalBridgedSILDebugVariable bridge (std::optional<swift::SILDebugVariable> &&debugVariable) {
1659
- OptionalBridgedSILDebugVariable bridgedVar;
1660
- *reinterpret_cast <std::optional<swift::SILDebugVariable> *>(&bridgedVar.storage ) = debugVariable;
1661
- return bridgedVar;
1657
+ BridgedSILDebugVariable::BridgedSILDebugVariable (const swift::SILDebugVariable &var) {
1658
+ new (&storage) swift::SILDebugVariable (var);
1659
+ }
1660
+
1661
+ BridgedSILDebugVariable::BridgedSILDebugVariable (const BridgedSILDebugVariable &rhs) {
1662
+ new (&storage) swift::SILDebugVariable (rhs.unbridge ());
1663
+ }
1664
+
1665
+ BridgedSILDebugVariable::~BridgedSILDebugVariable () {
1666
+ reinterpret_cast <swift::SILDebugVariable *>(&storage)->~SILDebugVariable ();
1667
+ }
1668
+
1669
+ BridgedSILDebugVariable &BridgedSILDebugVariable::operator =(const BridgedSILDebugVariable &rhs) {
1670
+ *reinterpret_cast <swift::SILDebugVariable *>(&storage) = rhs.unbridge ();
1671
+ return *this ;
1672
+ }
1673
+
1674
+ swift::SILDebugVariable BridgedSILDebugVariable::unbridge () const {
1675
+ return *reinterpret_cast <const swift::SILDebugVariable *>(&storage);
1662
1676
}
1663
1677
1664
1678
OptionalBridgedDeclObj BridgedInstruction::DebugValue_getDecl () const {
@@ -1681,19 +1695,25 @@ OptionalBridgedDeclObj BridgedInstruction::RefElementAddr_getDecl() const {
1681
1695
return {getAs<swift::RefElementAddrInst>()->getField ()};
1682
1696
}
1683
1697
1684
- OptionalBridgedSILDebugVariable
1685
- BridgedInstruction::DebugValue_getVarInfo () const {
1686
- return bridge (getAs<swift::DebugValueInst>()->getVarInfo ());
1698
+ bool BridgedInstruction::DebugValue_hasVarInfo () const {
1699
+ return getAs<swift::DebugValueInst>()->getVarInfo ().has_value ();
1700
+ }
1701
+ BridgedSILDebugVariable BridgedInstruction::DebugValue_getVarInfo () const {
1702
+ return BridgedSILDebugVariable (getAs<swift::DebugValueInst>()->getVarInfo ().value ());
1687
1703
}
1688
1704
1689
- OptionalBridgedSILDebugVariable
1690
- BridgedInstruction::AllocStack_getVarInfo () const {
1691
- return bridge (getAs<swift::AllocStackInst>()->getVarInfo ());
1705
+ bool BridgedInstruction::AllocStack_hasVarInfo () const {
1706
+ return getAs<swift::AllocStackInst>()->getVarInfo ().has_value ();
1707
+ }
1708
+ BridgedSILDebugVariable BridgedInstruction::AllocStack_getVarInfo () const {
1709
+ return BridgedSILDebugVariable (getAs<swift::AllocStackInst>()->getVarInfo ().value ());
1692
1710
}
1693
1711
1694
- OptionalBridgedSILDebugVariable
1695
- BridgedInstruction::AllocBox_getVarInfo () const {
1696
- return bridge (getAs<swift::AllocBoxInst>()->getVarInfo ());
1712
+ bool BridgedInstruction::AllocBox_hasVarInfo () const {
1713
+ return getAs<swift::AllocBoxInst>()->getVarInfo ().has_value ();
1714
+ }
1715
+ BridgedSILDebugVariable BridgedInstruction::AllocBox_getVarInfo () const {
1716
+ return BridgedSILDebugVariable (getAs<swift::AllocBoxInst>()->getVarInfo ().value ());
1697
1717
}
1698
1718
1699
1719
// ===----------------------------------------------------------------------===//
0 commit comments