Skip to content

Commit d2c668b

Browse files
authored
Merge pull request #27527 from gottesmm/pr-1abc9e6927939511bbfbed96d93a633ed05c0ca1
[ownership] Fix no-asserts build.
2 parents 2ddba9c + 4932755 commit d2c668b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/SIL/SILOwnershipVerifier.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,10 +642,20 @@ void SILValue::verifyOwnership(DeadEndBlocks *deadEndBlocks) const {
642642
if (DisableOwnershipVerification)
643643
return;
644644

645+
// Do not validate SILUndef values.
646+
if (isa<SILUndef>(Value))
647+
return;
648+
645649
#ifdef NDEBUG
646650
// When compiling without asserts enabled, only verify ownership if
647651
// -sil-verify-all is set.
648-
if (!getModule().getOptions().VerifyAll)
652+
//
653+
// NOTE: We purposely return if we do can not look up a module here to ensure
654+
// that if we run into something that we do not understand, we do not assert
655+
// in user code even tohugh we aren't going to actually verify (the default
656+
// behavior when -sil-verify-all is disabled).
657+
auto *Mod = Value->getModule();
658+
if (!Mod || !Mod->getOptions().VerifyAll)
649659
return;
650660
#endif
651661

0 commit comments

Comments
 (0)