@@ -354,10 +354,10 @@ class ScopeCreator final {
354354 ASTScopeImpl *constructExpandAndInsert (ASTScopeImpl *parent, Args... args) {
355355 auto *child = new (ctx) Scope (args...);
356356 parent->addChild (child, ctx);
357- if ( shouldBeLazy ()) {
358- if (auto *ip = child->insertionPointForDeferredExpansion ().getPtrOrNull ())
359- return ip;
360- }
357+
358+ if (auto *ip = child->insertionPointForDeferredExpansion ().getPtrOrNull ())
359+ return ip;
360+
361361 ASTScopeImpl *insertionPoint =
362362 child->expandAndBeCurrentDetectingRecursion (*this );
363363 ASTScopeAssert (child->verifyThatThisNodeComeAfterItsPriorSibling (),
@@ -646,8 +646,6 @@ class ScopeCreator final {
646646 return !n.isDecl (DeclKind::Var);
647647 }
648648
649- bool shouldBeLazy () const { return ctx.LangOpts .LazyASTScopes ; }
650-
651649public:
652650 // / For debugging. Return true if scope tree contains all the decl contexts in
653651 // / the AST May modify the scope tree in order to update obsolete scopes.
@@ -1121,14 +1119,13 @@ ASTScopeImpl *ASTScopeImpl::expandAndBeCurrent(ScopeCreator &scopeCreator) {
11211119 disownDescendants (scopeCreator);
11221120
11231121 auto *insertionPoint = expandSpecifically (scopeCreator);
1124- if (scopeCreator.shouldBeLazy ()) {
1125- ASTScopeAssert (!insertionPointForDeferredExpansion () ||
1126- insertionPointForDeferredExpansion ().get () ==
1127- insertionPoint,
1128- " In order for lookups into lazily-expanded scopes to be "
1129- " accurate before expansion, the insertion point before "
1130- " expansion must be the same as after expansion." );
1131- }
1122+ ASTScopeAssert (!insertionPointForDeferredExpansion () ||
1123+ insertionPointForDeferredExpansion ().get () ==
1124+ insertionPoint,
1125+ " In order for lookups into lazily-expanded scopes to be "
1126+ " accurate before expansion, the insertion point before "
1127+ " expansion must be the same as after expansion." );
1128+
11321129 replaceASTAncestorScopes (astAncestorScopes);
11331130 setWasExpanded ();
11341131 beCurrent ();
0 commit comments