[embedded] Implement swift_dynamicCast suport for casts from existential to concrete type

This commit is contained in:
Arnold Schwaighofer
2025-11-17 12:45:07 -08:00
parent a725de5ba6
commit 3cff05d540
9 changed files with 318 additions and 15 deletions

View File

@@ -797,6 +797,7 @@ struct BridgedInstruction {
BRIDGED_INLINE bool IndexAddrInst_needsStackProtection() const;
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedConformanceArray InitExistentialRefInst_getConformances() const;
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedCanType InitExistentialRefInst_getFormalConcreteType() const;
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedConformanceArray InitExistentialAddrInst_getConformances() const;
BRIDGED_INLINE bool OpenExistentialAddr_isImmutable() const;
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedGlobalVar GlobalAccessInst_getGlobal() const;
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedGlobalVar AllocGlobalInst_getGlobal() const;

View File

@@ -1249,6 +1249,9 @@ BridgedCanType BridgedInstruction::InitExistentialRefInst_getFormalConcreteType(
return getAs<swift::InitExistentialRefInst>()->getFormalConcreteType();
}
BridgedConformanceArray BridgedInstruction::InitExistentialAddrInst_getConformances() const {
return {getAs<swift::InitExistentialAddrInst>()->getConformances()};
}
bool BridgedInstruction::OpenExistentialAddr_isImmutable() const {
switch (getAs<swift::OpenExistentialAddrInst>()->getAccessKind()) {
case swift::OpenedExistentialAccess::Immutable: return true;