@@ -52,7 +52,6 @@ static llvm::cl::opt<bool> SkipUnreachableMustBeLastErrors(
52
52
53
53
// The verifier is basically all assertions, so don't compile it with NDEBUG to
54
54
// prevent release builds from triggering spurious unused variable warnings.
55
- #ifndef NDEBUG
56
55
57
56
// ===----------------------------------------------------------------------===//
58
57
// SILVerifier
@@ -4182,7 +4181,6 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
4182
4181
4183
4182
#undef require
4184
4183
#undef requireObjectType
4185
- #endif // NDEBUG
4186
4184
4187
4185
// ===----------------------------------------------------------------------===//
4188
4186
// Out of Line Verifier Run Functions
@@ -4191,17 +4189,22 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
4191
4189
// / verify - Run the SIL verifier to make sure that the SILFunction follows
4192
4190
// / invariants.
4193
4191
void SILFunction::verify (bool SingleFunction) const {
4194
- #ifndef NDEBUG
4192
+ #ifdef NDEBUG
4193
+ if (!getModule ().getOptions ().VerifyAll )
4194
+ return ;
4195
+ #endif
4195
4196
// Please put all checks in visitSILFunction in SILVerifier, not here. This
4196
4197
// ensures that the pretty stack trace in the verifier is included with the
4197
4198
// back trace when the verifier crashes.
4198
4199
SILVerifier (*this , SingleFunction).verify ();
4199
- #endif
4200
4200
}
4201
4201
4202
4202
// / Verify that a vtable follows invariants.
4203
4203
void SILVTable::verify (const SILModule &M) const {
4204
- #ifndef NDEBUG
4204
+ #ifdef NDEBUG
4205
+ if (!M.getOptions ().VerifyAll )
4206
+ return ;
4207
+ #endif
4205
4208
for (auto &entry : getEntries ()) {
4206
4209
// All vtable entries must be decls in a class context.
4207
4210
assert (entry.Method .hasDecl () && " vtable entry is not a decl" );
@@ -4254,12 +4257,14 @@ void SILVTable::verify(const SILModule &M) const {
4254
4257
" vtable entry for " + baseName + " must be ABI-compatible" );
4255
4258
}
4256
4259
}
4257
- #endif
4258
4260
}
4259
4261
4260
4262
// / Verify that a witness table follows invariants.
4261
4263
void SILWitnessTable::verify (const SILModule &M) const {
4262
- #ifndef NDEBUG
4264
+ #ifdef NDEBUG
4265
+ if (!M.getOptions ().VerifyAll )
4266
+ return ;
4267
+ #endif
4263
4268
if (isDeclaration ())
4264
4269
assert (getEntries ().size () == 0 &&
4265
4270
" A witness table declaration should not have any entries." );
@@ -4292,7 +4297,6 @@ void SILWitnessTable::verify(const SILModule &M) const {
4292
4297
" protocol." );
4293
4298
}
4294
4299
}
4295
- #endif
4296
4300
}
4297
4301
4298
4302
// / Verify that a default witness table follows invariants.
@@ -4323,20 +4327,25 @@ void SILDefaultWitnessTable::verify(const SILModule &M) const {
4323
4327
4324
4328
// / Verify that a global variable follows invariants.
4325
4329
void SILGlobalVariable::verify () const {
4326
- #ifndef NDEBUG
4330
+ #ifdef NDEBUG
4331
+ if (!getModule ().getOptions ().VerifyAll )
4332
+ return ;
4333
+ #endif
4327
4334
assert (getLoweredType ().isObject ()
4328
4335
&& " global variable cannot have address type" );
4329
4336
4330
4337
// Verify the static initializer.
4331
4338
if (InitializerF)
4332
4339
assert (SILGlobalVariable::canBeStaticInitializer (InitializerF) &&
4333
4340
" illegal static initializer" );
4334
- #endif
4335
4341
}
4336
4342
4337
4343
// / Verify the module.
4338
4344
void SILModule::verify () const {
4339
- #ifndef NDEBUG
4345
+ #ifdef NDEBUG
4346
+ if (!getOptions ().VerifyAll )
4347
+ return ;
4348
+ #endif
4340
4349
// Uniquing set to catch symbol name collisions.
4341
4350
llvm::StringSet<> symbolNames;
4342
4351
@@ -4406,7 +4415,6 @@ void SILModule::verify() const {
4406
4415
}
4407
4416
wt.verify (*this );
4408
4417
}
4409
- #endif
4410
4418
}
4411
4419
4412
4420
#ifndef NDEBUG
0 commit comments