@@ -68,32 +68,30 @@ const ASTScopeImpl *ASTScopeImpl::findStartingScopeForLookup(
6868 if (actualSF != sourceFile)
6969 fileScope = actualSF->getScope ().impl ;
7070
71- const auto *innermost = fileScope->findInnermostEnclosingScope (
72- sourceFile->getParentModule (), loc, nullptr );
71+ const auto *innermost = fileScope->findInnermostEnclosingScope (loc, nullptr );
7372 ASTScopeAssert (innermost->getWasExpanded (),
7473 " If looking in a scope, it must have been expanded." );
7574
7675 return innermost;
7776}
7877
7978ASTScopeImpl *
80- ASTScopeImpl::findInnermostEnclosingScope (ModuleDecl *parentModule,
81- SourceLoc loc,
79+ ASTScopeImpl::findInnermostEnclosingScope (SourceLoc loc,
8280 NullablePtr<raw_ostream> os) {
83- return findInnermostEnclosingScopeImpl (parentModule, loc, os,
84- getSourceManager (), getScopeCreator ());
81+ return findInnermostEnclosingScopeImpl (loc, os, getSourceManager () ,
82+ getScopeCreator ());
8583}
8684
8785ASTScopeImpl *ASTScopeImpl::findInnermostEnclosingScopeImpl (
88- ModuleDecl *parentModule, SourceLoc loc, NullablePtr<raw_ostream> os,
89- SourceManager &sourceMgr, ScopeCreator &scopeCreator) {
86+ SourceLoc loc, NullablePtr<raw_ostream> os, SourceManager &sourceMgr ,
87+ ScopeCreator &scopeCreator) {
9088 if (!getWasExpanded ())
9189 expandAndBeCurrent (scopeCreator);
92- auto child = findChildContaining (parentModule, loc, sourceMgr);
90+ auto child = findChildContaining (loc, sourceMgr);
9391 if (!child)
9492 return this ;
95- return child.get ()->findInnermostEnclosingScopeImpl (parentModule, loc, os,
96- sourceMgr, scopeCreator);
93+ return child.get ()->findInnermostEnclosingScopeImpl (loc, os, sourceMgr ,
94+ scopeCreator);
9795}
9896
9997// / If the \p loc is in a new buffer but \p range is not, consider the location
@@ -111,8 +109,7 @@ static SourceLoc translateLocForReplacedRange(SourceManager &sourceMgr,
111109}
112110
113111NullablePtr<ASTScopeImpl>
114- ASTScopeImpl::findChildContaining (ModuleDecl *parentModule,
115- SourceLoc loc,
112+ ASTScopeImpl::findChildContaining (SourceLoc loc,
116113 SourceManager &sourceMgr) const {
117114 if (loc.isInvalid ())
118115 return nullptr ;
@@ -596,8 +593,7 @@ llvm::SmallVector<LabeledStmt *, 4>
596593ASTScopeImpl::lookupLabeledStmts (SourceFile *sourceFile, SourceLoc loc) {
597594 // Find the innermost scope from which to start our search.
598595 auto *const fileScope = sourceFile->getScope ().impl ;
599- const auto *innermost = fileScope->findInnermostEnclosingScope (
600- sourceFile->getParentModule (), loc, nullptr );
596+ const auto *innermost = fileScope->findInnermostEnclosingScope (loc, nullptr );
601597 ASTScopeAssert (innermost->getWasExpanded (),
602598 " If looking in a scope, it must have been expanded." );
603599
@@ -625,8 +621,7 @@ std::pair<CaseStmt *, CaseStmt *> ASTScopeImpl::lookupFallthroughSourceAndDest(
625621 SourceFile *sourceFile, SourceLoc loc) {
626622 // Find the innermost scope from which to start our search.
627623 auto *const fileScope = sourceFile->getScope ().impl ;
628- const auto *innermost = fileScope->findInnermostEnclosingScope (
629- sourceFile->getParentModule (), loc, nullptr );
624+ const auto *innermost = fileScope->findInnermostEnclosingScope (loc, nullptr );
630625 ASTScopeAssert (innermost->getWasExpanded (),
631626 " If looking in a scope, it must have been expanded." );
632627
@@ -660,8 +655,7 @@ void ASTScopeImpl::lookupEnclosingMacroScope(
660655 return ;
661656
662657 auto *fileScope = sourceFile->getScope ().impl ;
663- auto *scope = fileScope->findInnermostEnclosingScope (
664- sourceFile->getParentModule (), loc, nullptr );
658+ auto *scope = fileScope->findInnermostEnclosingScope (loc, nullptr );
665659 do {
666660 if (auto expansionScope = dyn_cast<MacroExpansionDeclScope>(scope)) {
667661 auto *expansionDecl = expansionScope->decl ;
@@ -692,8 +686,7 @@ lookupEnclosingABIAttributeScope(SourceFile *sourceFile, SourceLoc loc) {
692686 return nullptr ;
693687
694688 auto *fileScope = sourceFile->getScope ().impl ;
695- auto *scope = fileScope->findInnermostEnclosingScope (
696- sourceFile->getParentModule (), loc, nullptr );
689+ auto *scope = fileScope->findInnermostEnclosingScope (loc, nullptr );
697690 do {
698691 if (auto abiAttrScope = dyn_cast<ABIAttributeScope>(scope)) {
699692 return abiAttrScope->attr ;
@@ -744,8 +737,7 @@ CatchNode ASTScopeImpl::lookupCatchNode(ModuleDecl *module, SourceLoc loc) {
744737 return nullptr ;
745738
746739 auto *fileScope = sourceFile->getScope ().impl ;
747- const auto *innermost = fileScope->findInnermostEnclosingScope (
748- module , loc, nullptr );
740+ const auto *innermost = fileScope->findInnermostEnclosingScope (loc, nullptr );
749741 ASTScopeAssert (innermost->getWasExpanded (),
750742 " If looking in a scope, it must have been expanded." );
751743
0 commit comments