@@ -442,8 +442,8 @@ class AccessFilteringDeclConsumer final : public VisibleDeclConsumer {
442442 DynamicLookupInfo dynamicLookupInfo = {}) override ;
443443};
444444
445- // / Filters out decls that are not usable based on their source location, eg .
446- // / a decl inside its own initializer or a non-type decl before its definition .
445+ // / Filters out decls that are not usable based on their source location, e.g .
446+ // / a top-level decl inside its own initializer or shadowed decls .
447447class UsableFilteringDeclConsumer final : public VisibleDeclConsumer {
448448 const SourceManager &SM;
449449 const DeclContext *DC;
@@ -465,7 +465,7 @@ class UsableFilteringDeclConsumer final : public VisibleDeclConsumer {
465465 }
466466
467467 void foundDecl (ValueDecl *D, DeclVisibilityKind reason,
468- DynamicLookupInfo dynamicLookupInfo) override ;
468+ DynamicLookupInfo dynamicLookupInfo = {} ) override ;
469469};
470470
471471// / Remove any declarations in the given set that were overridden by
@@ -504,14 +504,11 @@ bool removeShadowedDecls(TinyPtrVector<OperatorDecl *> &decls,
504504bool removeShadowedDecls (TinyPtrVector<PrecedenceGroupDecl *> &decls,
505505 const DeclContext *dc);
506506
507- // / Finds decls visible in the given context and feeds them to the given
508- // / VisibleDeclConsumer. If the current DeclContext is nested in a function,
509- // / the SourceLoc is used to determine which declarations in that function
510- // / are visible.
511- void lookupVisibleDecls (VisibleDeclConsumer &Consumer,
512- const DeclContext *DC,
513- bool IncludeTopLevel,
514- SourceLoc Loc = SourceLoc());
507+ // / Finds decls visible in the given context at the given location and feeds
508+ // / them to the given VisibleDeclConsumer. The \p Loc must be valid, and \p DC
509+ // / must be in a SourceFile.
510+ void lookupVisibleDecls (VisibleDeclConsumer &Consumer, SourceLoc Loc,
511+ const DeclContext *DC, bool IncludeTopLevel);
515512
516513// / Finds decls visible as members of the given type and feeds them to the given
517514// / VisibleDeclConsumer.
@@ -630,70 +627,6 @@ SelfBounds getSelfBoundsFromGenericSignature(const ExtensionDecl *extDecl);
630627
631628namespace namelookup {
632629
633- // / Searches through statements and patterns for local variable declarations.
634- class FindLocalVal : public StmtVisitor <FindLocalVal> {
635- friend class ASTVisitor <FindLocalVal>;
636-
637- const SourceManager &SM;
638- SourceLoc Loc;
639- VisibleDeclConsumer &Consumer;
640-
641- public:
642- FindLocalVal (const SourceManager &SM, SourceLoc Loc,
643- VisibleDeclConsumer &Consumer)
644- : SM(SM), Loc(Loc), Consumer(Consumer) {}
645-
646- void checkValueDecl (ValueDecl *D, DeclVisibilityKind Reason);
647-
648- void checkPattern (const Pattern *Pat, DeclVisibilityKind Reason);
649-
650- void checkParameterList (const ParameterList *params);
651-
652- void checkGenericParams (GenericParamList *Params);
653-
654- void checkSourceFile (const SourceFile &SF);
655-
656- private:
657- bool isReferencePointInRange (SourceRange R) {
658- return SM.rangeContainsTokenLoc (R, Loc);
659- }
660-
661- void visitBreakStmt (BreakStmt *) {}
662- void visitContinueStmt (ContinueStmt *) {}
663- void visitFallthroughStmt (FallthroughStmt *) {}
664- void visitFailStmt (FailStmt *) {}
665- void visitReturnStmt (ReturnStmt *) {}
666- void visitYieldStmt (YieldStmt *) {}
667- void visitThenStmt (ThenStmt *) {}
668- void visitThrowStmt (ThrowStmt *) {}
669- void visitDiscardStmt (DiscardStmt *) {}
670- void visitPoundAssertStmt (PoundAssertStmt *) {}
671- void visitDeferStmt (DeferStmt *DS) {
672- // Nothing in the defer is visible.
673- }
674-
675- void checkStmtCondition (const StmtCondition &Cond);
676-
677- void visitIfStmt (IfStmt *S);
678- void visitGuardStmt (GuardStmt *S);
679-
680- void visitWhileStmt (WhileStmt *S);
681- void visitRepeatWhileStmt (RepeatWhileStmt *S);
682- void visitDoStmt (DoStmt *S);
683-
684- void visitForEachStmt (ForEachStmt *S);
685-
686- void visitBraceStmt (BraceStmt *S, bool isTopLevelCode = false );
687-
688- void visitSwitchStmt (SwitchStmt *S);
689-
690- void visitCaseStmt (CaseStmt *S);
691-
692- void visitDoCatchStmt (DoCatchStmt *S);
693-
694- };
695-
696-
697630// / The bridge between the legacy UnqualifiedLookupFactory and the new ASTScope
698631// / lookup system
699632class AbstractASTScopeDeclConsumer {
@@ -737,9 +670,9 @@ class AbstractASTScopeDeclConsumer {
737670 }
738671
739672#ifndef NDEBUG
740- virtual void startingNextLookupStep () = 0;
741- virtual void finishingLookup (std::string) const = 0;
742- virtual bool isTargetLookup () const = 0;
673+ virtual void startingNextLookupStep () {}
674+ virtual void finishingLookup (std::string) const {}
675+ virtual bool isTargetLookup () const { return false ; }
743676#endif
744677};
745678
0 commit comments