Remove property behaviors

This commit is contained in:
Slava Pestov
2018-12-07 18:07:35 -05:00
parent e160b85f8f
commit aa747dcd81
54 changed files with 31 additions and 2571 deletions

View File

@@ -1869,49 +1869,7 @@ public:
|| isa<PointerToAddressInst>(Src),
"Mark Uninitialized must be applied to a storage location");
}
void checkMarkUninitializedBehaviorInst(MarkUninitializedBehaviorInst *MU) {
require(MU->getModule().getStage() == SILStage::Raw,
"mark_uninitialized instruction can only exist in raw SIL");
auto InitStorage = MU->getInitStorageFunc();
auto InitStorageTy = InitStorage->getType().getAs<SILFunctionType>();
require(InitStorageTy,
"mark_uninitialized initializer must be a function");
auto SubstInitStorageTy = InitStorageTy->substGenericArgs(F.getModule(),
MU->getInitStorageSubstitutions());
// FIXME: Destructured value or results?
require(SubstInitStorageTy->getResults().size() == 1,
"mark_uninitialized initializer must have one result");
auto StorageTy = SILType::getPrimitiveAddressType(
SubstInitStorageTy->getSingleResult().getType());
requireSameType(StorageTy, MU->getStorage()->getType(),
"storage must be address of initializer's result type");
auto Setter = MU->getSetterFunc();
auto SetterTy = Setter->getType().getAs<SILFunctionType>();
require(SetterTy,
"mark_uninitialized setter must be a function");
auto SubstSetterTy = SetterTy->substGenericArgs(F.getModule(),
MU->getSetterSubstitutions());
require(SubstSetterTy->getParameters().size() == 2,
"mark_uninitialized setter must have a value and self param");
requireSameType(fnConv.getSILType(SubstSetterTy->getSelfParameter()),
MU->getSelf()->getType(),
"self type must match setter's self parameter type");
auto ValueTy = SubstInitStorageTy->getParameters()[0].getType();
requireSameType(SILType::getPrimitiveAddressType(ValueTy),
SILType::getPrimitiveAddressType(
SubstSetterTy->getParameters()[0].getType()),
"value parameter type must match between initializer "
"and setter");
auto ValueAddrTy = SILType::getPrimitiveAddressType(ValueTy);
requireSameType(ValueAddrTy, MU->getType(),
"result of mark_uninitialized_behavior should be address "
"of value parameter to setter and initializer");
}
void checkMarkFunctionEscapeInst(MarkFunctionEscapeInst *MFE) {
require(MFE->getModule().getStage() == SILStage::Raw,
"mark_function_escape instruction can only exist in raw SIL");