[SIL] Generalize CastingIsolatedConformances to CheckedCastInstOptions

We are going to need to add more flags to the various checked cast
instructions. Generalize the CastingIsolatedConformances bit in all of
these SIL instructions to an "options" struct that's easier to extend.

Precursor to rdar://152335805.
This commit is contained in:
Doug Gregor
2025-06-04 16:52:25 -07:00
parent 2e1f876683
commit bc4cf1236b
31 changed files with 253 additions and 247 deletions

View File

@@ -180,7 +180,7 @@ public struct Builder {
public func createCheckedCastAddrBranch(
source: Value, sourceFormalType: CanonicalType,
destination: Value, targetFormalType: CanonicalType,
isolatedConformances: CastingIsolatedConformances,
options: CheckedCastInstOptions,
consumptionKind: CheckedCastAddrBranchInst.CastConsumptionKind,
successBlock: BasicBlock,
failureBlock: BasicBlock
@@ -195,7 +195,7 @@ public struct Builder {
let cast = bridged.createCheckedCastAddrBranch(source.bridged, sourceFormalType.bridged,
destination.bridged, targetFormalType.bridged,
isolatedConformances.bridged,
options.bridged,
bridgedConsumption,
successBlock.bridged, failureBlock.bridged)
return notifyNew(cast.getAs(CheckedCastAddrBranchInst.self))
@@ -203,13 +203,12 @@ public struct Builder {
@discardableResult
public func createUnconditionalCheckedCastAddr(
isolatedConformances: CastingIsolatedConformances,
options: CheckedCastInstOptions,
source: Value, sourceFormalType: CanonicalType,
destination: Value, targetFormalType: CanonicalType
) -> UnconditionalCheckedCastAddrInst {
let cast = bridged.createUnconditionalCheckedCastAddr(
isolatedConformances.bridged, source.bridged,
sourceFormalType.bridged,
options.bridged, source.bridged, sourceFormalType.bridged,
destination.bridged, targetFormalType.bridged
)
return notifyNew(cast.getAs(UnconditionalCheckedCastAddrInst.self))