Skip to content

Remove old unqualified lookup implementation #33822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions include/swift/Basic/LangOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,6 @@ namespace swift {
/// Should we stress ASTScope-based resolution for debugging?
bool StressASTScopeLookup = false;

/// Build the ASTScope tree lazily
bool LazyASTScopes = true;

/// Whether to enable the new operator decl and precedencegroup lookup
/// behavior. This is a staging flag, and will be removed in the future.
bool EnableNewOperatorLookup = false;
Expand Down
3 changes: 0 additions & 3 deletions include/swift/Option/FrontendOptions.td
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,6 @@ def crosscheck_unqualified_lookup : Flag<["-"], "crosscheck-unqualified-lookup">
def stress_astscope_lookup : Flag<["-"], "stress-astscope-lookup">,
HelpText<"Stress ASTScope-based unqualified name lookup (for testing)">;

def lazy_astscopes : Flag<["-"], "lazy-astscopes">,
HelpText<"Build ASTScopes lazily">;

def use_clang_function_types : Flag<["-"], "use-clang-function-types">,
HelpText<"Use stored Clang function types for computing canonical types.">;

Expand Down
25 changes: 11 additions & 14 deletions lib/AST/ASTScopeCreation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,10 @@ class ScopeCreator final {
ASTScopeImpl *constructExpandAndInsert(ASTScopeImpl *parent, Args... args) {
auto *child = new (ctx) Scope(args...);
parent->addChild(child, ctx);
if (shouldBeLazy()) {
if (auto *ip = child->insertionPointForDeferredExpansion().getPtrOrNull())
return ip;
}

if (auto *ip = child->insertionPointForDeferredExpansion().getPtrOrNull())
return ip;

ASTScopeImpl *insertionPoint =
child->expandAndBeCurrentDetectingRecursion(*this);
ASTScopeAssert(child->verifyThatThisNodeComeAfterItsPriorSibling(),
Expand Down Expand Up @@ -646,8 +646,6 @@ class ScopeCreator final {
return !n.isDecl(DeclKind::Var);
}

bool shouldBeLazy() const { return ctx.LangOpts.LazyASTScopes; }

public:
/// For debugging. Return true if scope tree contains all the decl contexts in
/// the AST May modify the scope tree in order to update obsolete scopes.
Expand Down Expand Up @@ -1121,14 +1119,13 @@ ASTScopeImpl *ASTScopeImpl::expandAndBeCurrent(ScopeCreator &scopeCreator) {
disownDescendants(scopeCreator);

auto *insertionPoint = expandSpecifically(scopeCreator);
if (scopeCreator.shouldBeLazy()) {
ASTScopeAssert(!insertionPointForDeferredExpansion() ||
insertionPointForDeferredExpansion().get() ==
insertionPoint,
"In order for lookups into lazily-expanded scopes to be "
"accurate before expansion, the insertion point before "
"expansion must be the same as after expansion.");
}
ASTScopeAssert(!insertionPointForDeferredExpansion() ||
insertionPointForDeferredExpansion().get() ==
insertionPoint,
"In order for lookups into lazily-expanded scopes to be "
"accurate before expansion, the insertion point before "
"expansion must be the same as after expansion.");

replaceASTAncestorScopes(astAncestorScopes);
setWasExpanded();
beCurrent();
Expand Down
2 changes: 0 additions & 2 deletions lib/AST/ASTScopeSourceRange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,6 @@ void ASTScopeImpl::computeAndCacheSourceRangeOfScope(
}

bool ASTScopeImpl::checkLazySourceRange(const ASTContext &ctx) const {
if (!ctx.LangOpts.LazyASTScopes)
return true;
const auto unexpandedRange = sourceRangeForDeferredExpansion();
const auto expandedRange = computeSourceRangeOfScopeWithChildASTNodes();
if (unexpandedRange.isInvalid() || expandedRange.isInvalid())
Expand Down
Loading