mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Push ArchetypeType's API down to subclasses.
And clean up code that conditionally works only with certain kinds of archetype along the way.
This commit is contained in:
@@ -253,9 +253,9 @@ public:
|
||||
return asImpl().remapASTType(ty);
|
||||
}
|
||||
|
||||
void remapOpenedType(CanArchetypeType archetypeTy) {
|
||||
void remapOpenedType(CanOpenedArchetypeType archetypeTy) {
|
||||
auto existentialTy = archetypeTy->getOpenedExistentialType()->getCanonicalType();
|
||||
auto replacementTy = ArchetypeType::getOpened(getOpASTType(existentialTy));
|
||||
auto replacementTy = OpenedArchetypeType::get(getOpASTType(existentialTy));
|
||||
registerOpenedExistentialRemapping(archetypeTy, replacementTy);
|
||||
}
|
||||
|
||||
@@ -1878,7 +1878,7 @@ template<typename ImplClass>
|
||||
void
|
||||
SILCloner<ImplClass>::visitOpenExistentialAddrInst(OpenExistentialAddrInst *Inst) {
|
||||
// Create a new archetype for this opened existential type.
|
||||
remapOpenedType(Inst->getType().castTo<ArchetypeType>());
|
||||
remapOpenedType(Inst->getType().castTo<OpenedArchetypeType>());
|
||||
|
||||
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
|
||||
recordClonedInstruction(
|
||||
@@ -1891,7 +1891,7 @@ template <typename ImplClass>
|
||||
void SILCloner<ImplClass>::visitOpenExistentialValueInst(
|
||||
OpenExistentialValueInst *Inst) {
|
||||
// Create a new archetype for this opened existential type.
|
||||
remapOpenedType(Inst->getType().castTo<ArchetypeType>());
|
||||
remapOpenedType(Inst->getType().castTo<OpenedArchetypeType>());
|
||||
|
||||
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
|
||||
recordClonedInstruction(Inst, getBuilder().createOpenExistentialValue(
|
||||
@@ -1911,7 +1911,7 @@ visitOpenExistentialMetatypeInst(OpenExistentialMetatypeInst *Inst) {
|
||||
exType = exMetatype.getInstanceType();
|
||||
openedType = cast<MetatypeType>(openedType).getInstanceType();
|
||||
}
|
||||
remapOpenedType(cast<ArchetypeType>(openedType));
|
||||
remapOpenedType(cast<OpenedArchetypeType>(openedType));
|
||||
|
||||
if (!Inst->getOperand()->getType().canUseExistentialRepresentation(
|
||||
Inst->getModule(), ExistentialRepresentation::Class)) {
|
||||
@@ -1935,7 +1935,7 @@ void
|
||||
SILCloner<ImplClass>::
|
||||
visitOpenExistentialRefInst(OpenExistentialRefInst *Inst) {
|
||||
// Create a new archetype for this opened existential type.
|
||||
remapOpenedType(Inst->getType().castTo<ArchetypeType>());
|
||||
remapOpenedType(Inst->getType().castTo<OpenedArchetypeType>());
|
||||
|
||||
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
|
||||
recordClonedInstruction(Inst, getBuilder().createOpenExistentialRef(
|
||||
@@ -1949,7 +1949,7 @@ void
|
||||
SILCloner<ImplClass>::
|
||||
visitOpenExistentialBoxInst(OpenExistentialBoxInst *Inst) {
|
||||
// Create a new archetype for this opened existential type.
|
||||
remapOpenedType(Inst->getType().castTo<ArchetypeType>());
|
||||
remapOpenedType(Inst->getType().castTo<OpenedArchetypeType>());
|
||||
|
||||
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
|
||||
recordClonedInstruction(Inst, getBuilder().createOpenExistentialBox(
|
||||
@@ -1963,7 +1963,7 @@ void
|
||||
SILCloner<ImplClass>::
|
||||
visitOpenExistentialBoxValueInst(OpenExistentialBoxValueInst *Inst) {
|
||||
// Create a new archetype for this opened existential type.
|
||||
remapOpenedType(Inst->getType().castTo<ArchetypeType>());
|
||||
remapOpenedType(Inst->getType().castTo<OpenedArchetypeType>());
|
||||
|
||||
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
|
||||
recordClonedInstruction(Inst, getBuilder().createOpenExistentialBoxValue(
|
||||
|
||||
Reference in New Issue
Block a user