void SILValue::verifyOwnership(DeadEndBlocks *deadEndBlocks) const { #ifndef NDEBUG if (DisableOwnershipVerification) return; // Since we do not have SILUndef, we now know that getFunction() should return // a real function. Assert in case this assumption is no longer true. SILFunction *f = (*this)->getFunction(); assert(f && "Instructions and arguments should have a function"); // If the given function has unqualified ownership or we have been asked by // the user not to verify this function, there is nothing to verify. if (!f->hasOwnership() || !f->shouldVerifyOwnership()) return; ErrorBehaviorKind errorBehavior; if (IsSILOwnershipVerifierTestingEnabled) { errorBehavior = ErrorBehaviorKind::PrintMessageAndReturnFalse; } else { errorBehavior = ErrorBehaviorKind::PrintMessageAndAssert; } llvm::SmallPtrSet<SILBasicBlock *, 32> liveBlocks; if (deadEndBlocks) { SILValueOwnershipChecker(*deadEndBlocks, *this, errorBehavior, liveBlocks) .check(); } else { DeadEndBlocks deadEndBlocks(f); SILValueOwnershipChecker(deadEndBlocks, *this, errorBehavior, liveBlocks) .check(); } #endif }