mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #8090 from shajrawi/ConsumptionKind_UnconditionalCheckedCastValue
Add consumption kind to UnconditionalCheckedCastValueInst
This commit is contained in:
@@ -801,10 +801,12 @@ public:
|
||||
}
|
||||
|
||||
UnconditionalCheckedCastValueInst *
|
||||
createUnconditionalCheckedCastValue(SILLocation Loc, SILValue op,
|
||||
SILType destTy) {
|
||||
createUnconditionalCheckedCastValue(SILLocation Loc,
|
||||
CastConsumptionKind consumption,
|
||||
SILValue op, SILType destTy) {
|
||||
return insert(UnconditionalCheckedCastValueInst::create(
|
||||
getSILDebugLocation(Loc), op, destTy, F, OpenedArchetypes));
|
||||
getSILDebugLocation(Loc), consumption, op, destTy, F,
|
||||
OpenedArchetypes));
|
||||
}
|
||||
|
||||
RetainValueInst *createRetainValue(SILLocation Loc, SILValue operand,
|
||||
|
||||
@@ -1165,7 +1165,7 @@ void SILCloner<ImplClass>::visitUnconditionalCheckedCastValueInst(
|
||||
SILType OpType = getOpType(Inst->getType());
|
||||
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
|
||||
doPostProcess(Inst, getBuilder().createUnconditionalCheckedCastValue(
|
||||
OpLoc, OpValue, OpType));
|
||||
OpLoc, Inst->getConsumptionKind(), OpValue, OpType));
|
||||
}
|
||||
|
||||
template <typename ImplClass>
|
||||
|
||||
@@ -2862,16 +2862,24 @@ class UnconditionalCheckedCastValueInst final
|
||||
ValueKind::UnconditionalCheckedCastValueInst,
|
||||
UnconditionalCheckedCastValueInst, ConversionInst, true> {
|
||||
friend SILBuilder;
|
||||
CastConsumptionKind ConsumptionKind;
|
||||
|
||||
UnconditionalCheckedCastValueInst(SILDebugLocation DebugLoc, SILValue Operand,
|
||||
UnconditionalCheckedCastValueInst(SILDebugLocation DebugLoc,
|
||||
CastConsumptionKind consumption,
|
||||
SILValue Operand,
|
||||
ArrayRef<SILValue> TypeDependentOperands,
|
||||
SILType DestTy)
|
||||
: UnaryInstructionWithTypeDependentOperandsBase(
|
||||
DebugLoc, Operand, TypeDependentOperands, DestTy) {}
|
||||
DebugLoc, Operand, TypeDependentOperands, DestTy),
|
||||
ConsumptionKind(consumption) {}
|
||||
|
||||
static UnconditionalCheckedCastValueInst *
|
||||
create(SILDebugLocation DebugLoc, SILValue Operand, SILType DestTy,
|
||||
SILFunction &F, SILOpenedArchetypesState &OpenedArchetypes);
|
||||
create(SILDebugLocation DebugLoc, CastConsumptionKind consumption,
|
||||
SILValue Operand, SILType DestTy, SILFunction &F,
|
||||
SILOpenedArchetypesState &OpenedArchetypes);
|
||||
|
||||
public:
|
||||
CastConsumptionKind getConsumptionKind() const { return ConsumptionKind; }
|
||||
};
|
||||
|
||||
/// StructInst - Represents a constructed loadable struct.
|
||||
|
||||
Reference in New Issue
Block a user