SILVerifier: verify that retain_value must not have a non-copyable operand

This commit is contained in:
Erik Eckstein
2024-11-05 10:51:45 +01:00
parent 3efa770c86
commit 1cbfa1a1a5
2 changed files with 2 additions and 33 deletions

View File

@@ -3391,6 +3391,8 @@ public:
void checkRetainValueInst(RetainValueInst *I) {
require(I->getOperand()->getType().isObject(),
"Source value should be an object value");
require(!I->getOperand()->getType().isMoveOnly(),
"retain value operand type must be copyable");
require(!F.hasOwnership(),
"retain_value is only in functions with unqualified ownership");
}