[ASTScope] Upgrade checkSourceRangeBeforeAddingChild to conditional assert

Allow enabling in release builds.
This commit is contained in:
Hamish Knight
2025-03-31 08:20:34 +01:00
parent 4efe08e3ae
commit 946b61ae08

View File

@@ -713,9 +713,8 @@ void ASTScopeImpl::addChild(ASTScopeImpl *child, ASTContext &ctx) {
ASTScopeAssert(!child->getParent(), "child should not already have parent");
child->parentAndWasExpanded.setPointer(this);
#ifndef NDEBUG
checkSourceRangeBeforeAddingChild(child, ctx);
#endif
if (CONDITIONAL_ASSERT_enabled())
checkSourceRangeBeforeAddingChild(child, ctx);
// If this is the first time we've added children, notify the ASTContext
// that there's a SmallVector that needs to be cleaned up.