Skip to content

Commit 257ae1b

Browse files
committed
Update comments
1 parent 10a96df commit 257ae1b

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

include/swift/AST/ASTContext.h

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -477,26 +477,24 @@ class ASTContext final {
477477
/// specified string.
478478
Identifier getIdentifier(StringRef Str) const;
479479

480-
/// Convert a given alias map to a map of Identifiers between module aliases and their actual names.
481-
/// For example, if '-module-alias Foo=X -module-alias Bar=Y' input is passed in, the aliases Foo and Bar are
482-
/// the names of the imported or referenced modules in source files in the main module, and X and Y
483-
/// are the real (physical) module names on disk.
480+
/// Convert a given module alias map (with `-module-alias` option) to a map of entries that are
481+
/// keyed both module aliases and real names along with a boolean indicating whether the entry
482+
/// is an alias or a real name.
483+
/// An entry with a module alias as key will have value: (real module name, true), and
484+
/// an entry with a module real name as key will have value: (module alias, false).
484485
void setModuleAliases(const llvm::StringMap<StringRef> &aliasMap);
485486

486487
/// Retrieve the actual module name if a module alias is used via '-module-alias Foo=X', where Foo is
487488
/// a module alias and X is the real (physical) name. Returns \p key if no aliasing is used.
488489
Identifier getRealModuleName(Identifier key) const;
489490

490-
/// Checks if the given \p key is a module alias or a module real name.
491-
/// If \p key is a module alias, it returns a pair of its corresponding real name and 'true',
492-
/// if \p key is a module real name, it returns a pair of its corresponding alias, and 'false', and
493-
/// if \p key is a non-aliased module name, it returns a pair of that given name and 'true'.
494-
///
495-
/// This can be used to check if the module real name appears in source files, in which case error diags
496-
/// should be emitted (only aliases should allowed).
497-
///
498-
/// \param key A module name (alias, real name, or non-aliased name)
499-
/// \returns A pair of the module real name and 'true' if the \p key is an alias
491+
/// Retrieve the value mapped to the given key.
492+
/// \param key A module alias or real name (or non-aliased name) to look up
493+
/// \returns A pair of a module alias or real name given \p key, and a boolean indicating if the
494+
/// \p key is an alias
495+
/// If \p key is a module alias, it returns: (corresponding real name, true)
496+
/// if \p key is a module real name, it returns: (corresponding alias, false), and
497+
/// if \p key is a non-aliased module name, it returns (key, true).
500498
std::pair<Identifier, bool> getRealModuleNameOrAlias(Identifier key) const;
501499

502500
/// Decide how to interpret two precedence groups.

lib/Parse/ParseDecl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4825,8 +4825,8 @@ ParserResult<ImportDecl> Parser::parseDeclImport(ParseDeclOptions Flags,
48254825
auto parsedModuleID = importPath.get().front().Item;
48264826
auto checkResult = Context.getRealModuleNameOrAlias(parsedModuleID);
48274827
if (!checkResult.second) {
4828-
// This means the parsed module name is the real name that appeared in
4829-
// the source file; only the module alias should be allowed
4828+
// If reached here, it means the parsed module name is a real module name
4829+
// which appeared in the source file; only a module alias should be allowed
48304830
diagnose(importPath.front().Loc, diag::expected_module_alias)
48314831
.fixItReplace(importPath.front().Loc, checkResult.first.str());
48324832
return nullptr;

0 commit comments

Comments
 (0)