Skip to content

Commit b801c77

Browse files
committed
SIL: add some APIs for InitExistentialAddrInst
* `var conformances: ConformanceArray` * `var formalConcreteType: CanonicalType`
1 parent 699f78e commit b801c77

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

SwiftCompilerSources/Sources/SIL/Instruction.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,15 @@ final public
879879
class OpenExistentialValueInst : SingleValueInstruction, UnaryInstruction {}
880880

881881
final public
882-
class InitExistentialAddrInst : SingleValueInstruction, UnaryInstruction {}
882+
class InitExistentialAddrInst : SingleValueInstruction, UnaryInstruction {
883+
public var conformances: ConformanceArray {
884+
ConformanceArray(bridged: bridged.InitExistentialAddrInst_getConformances())
885+
}
886+
887+
public var formalConcreteType: CanonicalType {
888+
CanonicalType(bridged: bridged.InitExistentialAddrInst_getFormalConcreteType())
889+
}
890+
}
883891

884892
final public
885893
class DeinitExistentialAddrInst : Instruction, UnaryInstruction {}

include/swift/SIL/SILBridging.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,8 @@ struct BridgedInstruction {
796796
BRIDGED_INLINE bool IndexAddrInst_needsStackProtection() const;
797797
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedConformanceArray InitExistentialRefInst_getConformances() const;
798798
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedCanType InitExistentialRefInst_getFormalConcreteType() const;
799+
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedConformanceArray InitExistentialAddrInst_getConformances() const;
800+
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedCanType InitExistentialAddrInst_getFormalConcreteType() const;
799801
BRIDGED_INLINE bool OpenExistentialAddr_isImmutable() const;
800802
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedGlobalVar GlobalAccessInst_getGlobal() const;
801803
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedGlobalVar AllocGlobalInst_getGlobal() const;

include/swift/SIL/SILBridgingImpl.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,6 +1245,14 @@ BridgedCanType BridgedInstruction::InitExistentialRefInst_getFormalConcreteType(
12451245
return getAs<swift::InitExistentialRefInst>()->getFormalConcreteType();
12461246
}
12471247

1248+
BridgedConformanceArray BridgedInstruction::InitExistentialAddrInst_getConformances() const {
1249+
return {getAs<swift::InitExistentialAddrInst>()->getConformances()};
1250+
}
1251+
1252+
BridgedCanType BridgedInstruction::InitExistentialAddrInst_getFormalConcreteType() const {
1253+
return getAs<swift::InitExistentialAddrInst>()->getFormalConcreteType();
1254+
}
1255+
12481256
bool BridgedInstruction::OpenExistentialAddr_isImmutable() const {
12491257
switch (getAs<swift::OpenExistentialAddrInst>()->getAccessKind()) {
12501258
case swift::OpenedExistentialAccess::Immutable: return true;

0 commit comments

Comments
 (0)