mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL: Give project_box a field index operand.
Allow project_box to get the address of any field in a multi-field box.
This commit is contained in:
@@ -1226,17 +1226,13 @@ public:
|
||||
return insert(new (F.getModule()) ProjectValueBufferInst(
|
||||
getSILDebugLocation(Loc), valueType, operand));
|
||||
}
|
||||
ProjectBoxInst *createProjectBox(SILLocation Loc, SILValue boxOperand) {
|
||||
auto valueTy =
|
||||
boxOperand->getType().castTo<SILBoxType>()->getBoxedAddressType();
|
||||
ProjectBoxInst *createProjectBox(SILLocation Loc, SILValue boxOperand,
|
||||
unsigned index) {
|
||||
auto boxTy = boxOperand->getType().castTo<SILBoxType>();
|
||||
auto fieldTy = boxTy->getFieldType(index);
|
||||
|
||||
return insert(new (F.getModule()) ProjectBoxInst(
|
||||
getSILDebugLocation(Loc), valueTy, boxOperand));
|
||||
}
|
||||
ProjectBoxInst *createProjectBox(SILLocation Loc, SILType valueTy,
|
||||
SILValue boxOperand) {
|
||||
return insert(new (F.getModule()) ProjectBoxInst(
|
||||
getSILDebugLocation(Loc), valueTy, boxOperand));
|
||||
getSILDebugLocation(Loc), boxOperand, index, fieldTy));
|
||||
}
|
||||
ProjectExistentialBoxInst *createProjectExistentialBox(SILLocation Loc,
|
||||
SILType valueTy,
|
||||
|
||||
Reference in New Issue
Block a user