mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #74707 from jckarter/consume-during-borrow-checks
MoveOnlyAddressChecker: More robust checking for consume-during-borrow.
This commit is contained in:
@@ -4591,14 +4591,29 @@ public:
|
||||
/// instruction in its use-def list.
|
||||
class LoadBorrowInst :
|
||||
public UnaryInstructionBase<SILInstructionKind::LoadBorrowInst,
|
||||
SingleValueInstruction> {
|
||||
SingleValueInstruction>
|
||||
{
|
||||
friend class SILBuilder;
|
||||
|
||||
bool Unchecked = false;
|
||||
|
||||
public:
|
||||
LoadBorrowInst(SILDebugLocation DebugLoc, SILValue LValue)
|
||||
: UnaryInstructionBase(DebugLoc, LValue,
|
||||
LValue->getType().getObjectType()) {}
|
||||
|
||||
// True if the invariants on `load_borrow` have not been checked and
|
||||
// should not be strictly enforced.
|
||||
//
|
||||
// This can only occur during raw SIL before move-only checking occurs.
|
||||
// Developers can write incorrect code using noncopyable types that
|
||||
// consumes or mutates a memory location while that location is borrowed,
|
||||
// but the move-only checker must diagnose those problems before canonical
|
||||
// SIL is formed.
|
||||
bool isUnchecked() const { return Unchecked; }
|
||||
|
||||
void setUnchecked(bool value) { Unchecked = value; }
|
||||
|
||||
using EndBorrowRange =
|
||||
decltype(std::declval<ValueBase>().getUsersOfType<EndBorrowInst>());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user