Merge pull request #85602 from aschwaighofer/wip_embedded_exit_cast

[embedded] Implement swift_dynamicCast suport for casts from existential to concrete type
This commit is contained in:
Arnold Schwaighofer
2025-11-20 21:01:41 -05:00
committed by GitHub
9 changed files with 318 additions and 15 deletions

View File

@@ -808,6 +808,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

@@ -1288,6 +1288,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;