Skip to content

Commit 2c98c7d

Browse files
committed
[SIL Builder] Don't try to micro-optimize away a bool parameter with NDEBUG
1 parent 386c180 commit 2c98c7d

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

include/swift/SIL/SILBuilder.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -413,18 +413,18 @@ class SILBuilder {
413413
AllocStackInst *createAllocStack(SILLocation Loc, SILType elementType,
414414
Optional<SILDebugVariable> Var = None,
415415
bool hasDynamicLifetime = false,
416-
bool isLexical = false, bool wasMoved = false
417-
#ifndef NDEBUG
418-
,
416+
bool isLexical = false,
417+
bool wasMoved = false,
419418
bool skipVarDeclAssert = false
420-
#endif
421419
) {
422420
llvm::SmallString<4> Name;
423421
Loc.markAsPrologue();
424422
#ifndef NDEBUG
425423
if (dyn_cast_or_null<VarDecl>(Loc.getAsASTNode<Decl>()))
426424
assert((skipVarDeclAssert || Loc.isSynthesizedAST() || Var) &&
427425
"location is a VarDecl, but SILDebugVariable is empty");
426+
#else
427+
(void)skipVarDeclAssert;
428428
#endif
429429
return insert(AllocStackInst::create(
430430
getSILDebugLocation(Loc, true), elementType, getFunction(),
@@ -473,19 +473,20 @@ class SILBuilder {
473473
return createAllocBox(loc, SILBoxType::get(fieldType.getASTType()), Var,
474474
hasDynamicLifetime, reflection,
475475
usesMoveableValueDebugInfo,
476-
/*skipVarDeclAssert*/ false, hasPointerEscape);
476+
/*skipVarDeclAssert*/ false,
477+
hasPointerEscape);
477478
}
478479

479480
AllocBoxInst *createAllocBox(SILLocation Loc, CanSILBoxType BoxType,
480481
Optional<SILDebugVariable> Var = None,
481482
bool hasDynamicLifetime = false,
482483
bool reflection = false,
483-
bool usesMoveableValueDebugInfo = false
484-
#ifndef NDEBUG
485-
,
484+
bool usesMoveableValueDebugInfo = false,
486485
bool skipVarDeclAssert = false,
487-
#endif
488486
bool hasPointerEscape = false) {
487+
#if NDEBUG
488+
(void)skipVarDeclAssert;
489+
#endif
489490
llvm::SmallString<4> Name;
490491
Loc.markAsPrologue();
491492
assert((skipVarDeclAssert ||

0 commit comments

Comments
 (0)