mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Verify @inout_aliasable captures.
This is currently only done in DiagnoseStaticExclusivity because AllocBoxToStack doesn't know how to set @noescape function types yet.
This commit is contained in:
@@ -234,6 +234,53 @@ SILValue swift::stripBorrow(SILValue V) {
|
||||
return V;
|
||||
}
|
||||
|
||||
SingleValueInstruction *swift::getSingleValueCopyOrCast(SILInstruction *I) {
|
||||
if (auto *convert = dyn_cast<ConversionInst>(I))
|
||||
return convert;
|
||||
|
||||
switch (I->getKind()) {
|
||||
default:
|
||||
return nullptr;
|
||||
case SILInstructionKind::CopyValueInst:
|
||||
case SILInstructionKind::CopyBlockInst:
|
||||
case SILInstructionKind::BeginBorrowInst:
|
||||
case SILInstructionKind::BeginAccessInst:
|
||||
return cast<SingleValueInstruction>(I);
|
||||
}
|
||||
}
|
||||
|
||||
bool swift::isIncidentalUse(SILInstruction *user) {
|
||||
switch (user->getKind()) {
|
||||
default:
|
||||
return false;
|
||||
case SILInstructionKind::DebugValueInst:
|
||||
case SILInstructionKind::EndAccessInst:
|
||||
case SILInstructionKind::EndBorrowInst:
|
||||
case SILInstructionKind::EndLifetimeInst:
|
||||
case SILInstructionKind::FixLifetimeInst:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool swift::onlyAffectsRefCount(SILInstruction *user) {
|
||||
switch (user->getKind()) {
|
||||
default:
|
||||
return false;
|
||||
case SILInstructionKind::AutoreleaseValueInst:
|
||||
case SILInstructionKind::DestroyValueInst:
|
||||
case SILInstructionKind::ReleaseValueInst:
|
||||
case SILInstructionKind::RetainValueInst:
|
||||
case SILInstructionKind::StrongReleaseInst:
|
||||
case SILInstructionKind::StrongRetainInst:
|
||||
case SILInstructionKind::UnmanagedAutoreleaseValueInst:
|
||||
case SILInstructionKind::UnmanagedReleaseValueInst:
|
||||
case SILInstructionKind::UnmanagedRetainValueInst:
|
||||
case SILInstructionKind::UnownedReleaseInst:
|
||||
case SILInstructionKind::UnownedRetainInst:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
enum class OwnershipQualifiedKind {
|
||||
|
||||
Reference in New Issue
Block a user