Skip to content

Commit 4991bf9

Browse files
committed
[NFC] Improve some lookup-related doc comments
1 parent 1ecabaf commit 4991bf9

File tree

3 files changed

+45
-8
lines changed

3 files changed

+45
-8
lines changed

include/swift/AST/ModuleNameLookup.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,25 @@ enum class ResolutionKind {
4444

4545
void simple_display(llvm::raw_ostream &out, ResolutionKind kind);
4646

47-
/// Performs a lookup into the given module and it's imports.
47+
/// Performs a lookup into the given module and its imports.
4848
///
49-
/// If 'moduleOrFile' is a ModuleDecl, we search the module and it's
49+
/// If 'moduleOrFile' is a ModuleDecl, we search the module and its
5050
/// public imports. If 'moduleOrFile' is a SourceFile, we search the
5151
/// file's parent module, the module's public imports, and the source
5252
/// file's private imports.
5353
///
54-
/// \param moduleOrFile The module or file unit whose imports to search.
54+
/// \param moduleOrFile The module or file unit to search, including imports.
5555
/// \param name The name to look up.
5656
/// \param[out] decls Any found decls will be added to this vector.
5757
/// \param lookupKind Whether this lookup is qualified or unqualified.
5858
/// \param resolutionKind What sort of decl is expected.
5959
/// \param moduleScopeContext The top-level context from which the lookup is
6060
/// being performed, for checking access. This must be either a
6161
/// FileUnit or a Module.
62+
/// \param loc Source location of the lookup. Used to add contextual options,
63+
/// such as disabling macro expansions inside macro arguments.
6264
/// \param options name lookup options. Currently only used to communicate the
63-
/// NL_IncludeUsableFromInline option.
65+
/// NL_IncludeUsableFromInline option.
6466
void lookupInModule(const DeclContext *moduleOrFile,
6567
DeclName name, SmallVectorImpl<ValueDecl *> &decls,
6668
NLKind lookupKind, ResolutionKind resolutionKind,

include/swift/AST/NameLookupRequests.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,22 @@ class LookupInModuleRequest
488488
private:
489489
friend SimpleRequest;
490490

491-
// Evaluation.
491+
/// Performs a lookup into the given module and its imports.
492+
///
493+
/// If 'moduleOrFile' is a ModuleDecl, we search the module and its
494+
/// public imports. If 'moduleOrFile' is a SourceFile, we search the
495+
/// file's parent module, the module's public imports, and the source
496+
/// file's private imports.
497+
///
498+
/// \param evaluator The request evaluator.
499+
/// \param moduleOrFile The module or file unit to search, including imports.
500+
/// \param name The name to look up.
501+
/// \param lookupKind Whether this lookup is qualified or unqualified.
502+
/// \param resolutionKind What sort of decl is expected.
503+
/// \param moduleScopeContext The top-level context from which the lookup is
504+
/// being performed, for checking access. This must be either a
505+
/// FileUnit or a Module.
506+
/// \param options Lookup options to apply.
492507
QualifiedLookupResult
493508
evaluate(Evaluator &evaluator, const DeclContext *moduleOrFile, DeclName name,
494509
NLKind lookupKind, namelookup::ResolutionKind resolutionKind,

lib/AST/ModuleNameLookup.cpp

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,22 @@ class ModuleNameLookup {
5151
resolutionKind(resolutionKind),
5252
respectAccessControl(!ctx.isAccessControlDisabled()) {}
5353

54-
/// Performs a qualified lookup into the given module and, if necessary, its
55-
/// reexports.
54+
/// Performs the qualified lookup requested by \p LookupStrategy into the
55+
/// given module and, if necessary, its reexports.
5656
///
57-
/// The results are appended to \p decls.
57+
/// If 'moduleOrFile' is a ModuleDecl, we search the module and its
58+
/// public imports. If 'moduleOrFile' is a SourceFile, we search the
59+
/// file's parent module, the module's public imports, and the source
60+
/// file's private imports.
61+
///
62+
/// \param[out] decls Results are appended to this vector.
63+
/// \param moduleOrFile The module or file unit to search, including imports.
64+
/// \param accessPath The access path that was imported; if not empty, only
65+
/// the named declaration will be imported.
66+
/// \param moduleScopeContext The top-level context from which the lookup is
67+
/// being performed, for checking access. This must be either a
68+
/// FileUnit or a Module.
69+
/// \param options Lookup options to apply.
5870
void lookupInModule(SmallVectorImpl<ValueDecl *> &decls,
5971
const DeclContext *moduleOrFile,
6072
ImportPath::Access accessPath,
@@ -77,6 +89,10 @@ class LookupByName : public ModuleNameLookup<LookupByName> {
7789
const NLKind lookupKind;
7890

7991
public:
92+
/// \param ctx The AST context that the lookup will be performed in.
93+
/// \param name The name that will be looked up.
94+
/// \param lookupKind Whether this lookup is qualified or unqualified.
95+
/// \param resolutionKind What sort of decl is expected.
8096
LookupByName(ASTContext &ctx, ResolutionKind resolutionKind,
8197
DeclName name, NLKind lookupKind)
8298
: Super(ctx, resolutionKind), name(name),
@@ -89,6 +105,10 @@ class LookupByName : public ModuleNameLookup<LookupByName> {
89105
return true;
90106
}
91107

108+
/// \param module The module to search for declarations in.
109+
/// \param path The access path that was imported; if not empty, only the
110+
/// named declaration will be imported.
111+
/// \param[out] localDecls Results are appended to this vector.
92112
void doLocalLookup(ModuleDecl *module, ImportPath::Access path,
93113
OptionSet<ModuleLookupFlags> flags,
94114
SmallVectorImpl<ValueDecl *> &localDecls) {

0 commit comments

Comments
 (0)