[SIL] Added isLexical to ValueBase.

This commit is contained in:
Nate Chandler
2022-01-25 08:14:52 -08:00
parent 572510835b
commit 7d4f6ffd7d
2 changed files with 14 additions and 0 deletions

View File

@@ -98,6 +98,18 @@ ValueBase::getDefiningInstructionResult() {
return None;
}
bool ValueBase::isLexical() const {
// TODO: Eventually, rather than SILGen'ing a borrow scope for owned
// arguments, we will just have this check here.
// if (auto *argument = dyn_cast<SILArgument>(this))
// return argument->getOwnershipKind() == OwnershipKind::Owned;
if (auto *bbi = dyn_cast<BeginBorrowInst>(this))
return bbi->isLexical();
if (auto *mvi = dyn_cast<MoveValueInst>(this))
return mvi->isLexical();
return false;
}
SILBasicBlock *SILNode::getParentBlock() const {
if (auto *Inst = dyn_cast<SILInstruction>(this))
return Inst->getParent();