Add a new semantics attribute to disable SIL verification on a function

This provides a way to disable verification per function instead of the entire module.
This commit is contained in:
Meghana Gupta
2025-05-14 15:38:59 -07:00
parent 294e4cf21b
commit aa01b2ad06
5 changed files with 35 additions and 5 deletions

View File

@@ -20,6 +20,7 @@
#include "swift/AST/Decl.h"
#include "swift/AST/GenericEnvironment.h"
#include "swift/AST/Module.h"
#include "swift/AST/SemanticAttrs.h"
#include "swift/AST/Types.h"
#include "swift/Basic/Assertions.h"
#include "swift/Basic/Range.h"
@@ -866,6 +867,14 @@ void SILInstruction::verifyOperandOwnership(
return;
#endif
if (getModule().getOptions().VerifyNone) {
return;
}
if (getFunction()->hasSemanticsAttr(semantics::NO_SIL_VERIFICATION)) {
return;
}
// If SILOwnership is not enabled, do not perform verification.
if (!getModule().getOptions().VerifySILOwnership)
return;