Skip to content

Commit 765dd47

Browse files
authored
Merge pull request #33822 from slavapestov/remove-old-unqualified-lookup
Remove old unqualified lookup implementation
2 parents 87e1a13 + 83f49b3 commit 765dd47

File tree

9 files changed

+67
-687
lines changed

9 files changed

+67
-687
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,6 @@ namespace swift {
254254
/// Should we stress ASTScope-based resolution for debugging?
255255
bool StressASTScopeLookup = false;
256256

257-
/// Build the ASTScope tree lazily
258-
bool LazyASTScopes = true;
259-
260257
/// Whether to enable the new operator decl and precedencegroup lookup
261258
/// behavior. This is a staging flag, and will be removed in the future.
262259
bool EnableNewOperatorLookup = false;

include/swift/Option/FrontendOptions.td

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,6 @@ def crosscheck_unqualified_lookup : Flag<["-"], "crosscheck-unqualified-lookup">
160160
def stress_astscope_lookup : Flag<["-"], "stress-astscope-lookup">,
161161
HelpText<"Stress ASTScope-based unqualified name lookup (for testing)">;
162162

163-
def lazy_astscopes : Flag<["-"], "lazy-astscopes">,
164-
HelpText<"Build ASTScopes lazily">;
165-
166163
def use_clang_function_types : Flag<["-"], "use-clang-function-types">,
167164
HelpText<"Use stored Clang function types for computing canonical types.">;
168165

lib/AST/ASTScopeCreation.cpp

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
651649
public:
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();

lib/AST/ASTScopeSourceRange.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,8 +526,6 @@ void ASTScopeImpl::computeAndCacheSourceRangeOfScope(
526526
}
527527

528528
bool ASTScopeImpl::checkLazySourceRange(const ASTContext &ctx) const {
529-
if (!ctx.LangOpts.LazyASTScopes)
530-
return true;
531529
const auto unexpandedRange = sourceRangeForDeferredExpansion();
532530
const auto expandedRange = computeSourceRangeOfScopeWithChildASTNodes();
533531
if (unexpandedRange.isInvalid() || expandedRange.isInvalid())

0 commit comments

Comments
 (0)