Skip to content

Commit 3cd653d

Browse files
authored
Merge pull request #66226 from apple/es-alias-rename
Update module aliasing terms in diagnostics and comments
2 parents e098889 + 8c66776 commit 3cd653d

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

include/swift/AST/DiagnosticsFrontend.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,11 @@ ERROR(error_empty_package_name,none,
195195
ERROR(error_stdlib_not_found,Fatal,
196196
"unable to load standard library for target '%0'", (StringRef))
197197
ERROR(error_module_alias_invalid_format,none,
198-
"invalid module alias format \"%0\"; make sure to use the format '-module-alias alias_name=underlying_name'", (StringRef))
198+
"invalid module alias format \"%0\"; make sure to use the format '-module-alias alias_name=real_name'", (StringRef))
199199
ERROR(error_module_alias_forbidden_name,none,
200200
"invalid module alias \"%0\"; make sure the alias differs from the module name, module ABI name, module link name, and a standard library name", (StringRef))
201201
ERROR(error_module_alias_duplicate,none,
202-
"duplicate module alias; the name \"%0\" is already used for a module alias or an underlying name", (StringRef))
202+
"duplicate module alias; the name \"%0\" is already used for an alias or a real name", (StringRef))
203203

204204
ERROR(error_unable_to_load_supplementary_output_file_map, none,
205205
"unable to load supplementary output file map '%0': %1",

include/swift/Frontend/FrontendOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class FrontendOptions {
5151
/// An Objective-C header to import and make implicitly visible.
5252
std::string ImplicitObjCHeaderPath;
5353

54-
/// The map of aliases and underlying names of imported or referenced modules.
54+
/// The map of aliases and real names of imported or referenced modules.
5555
llvm::StringMap<StringRef> ModuleAliasMap;
5656

5757
/// The name of the module that the frontend is building.

include/swift/Option/Options.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,8 +523,8 @@ def module_name_EQ : Joined<["-"], "module-name=">, Flags<[FrontendOption]>,
523523

524524
def module_alias : Separate<["-"], "module-alias">,
525525
Flags<[FrontendOption, ModuleInterfaceOption]>,
526-
MetaVarName<"<alias_name=underlying_name>">,
527-
HelpText<"If a source file imports or references module <alias_name>, the <underlying_name> is used for the contents of the file">;
526+
MetaVarName<"<alias_name=real_name>">,
527+
HelpText<"If a source file imports or references module <alias_name>, the <real_name> is used for the contents of the file">;
528528

529529
def module_link_name : Separate<["-"], "module-link-name">,
530530
Flags<[FrontendOption, ModuleInterfaceOption]>,

lib/Frontend/ArgsToFrontendOptionsConverter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ bool ModuleAliasesConverter::computeModuleAliases(std::vector<std::string> args,
831831

832832
for (auto item: args) {
833833
auto str = StringRef(item);
834-
// splits to an alias and the underlying name
834+
// splits to an alias and its real name
835835
auto pair = str.split('=');
836836
auto lhs = pair.first;
837837
auto rhs = pair.second;
@@ -844,13 +844,13 @@ bool ModuleAliasesConverter::computeModuleAliases(std::vector<std::string> args,
844844
return false;
845845
}
846846

847-
// First, add the underlying name as a key to prevent it from being
847+
// First, add the real name as a key to prevent it from being
848848
// used as an alias
849849
if (!options.ModuleAliasMap.insert({rhs, StringRef()}).second) {
850850
diags.diagnose(SourceLoc(), diag::error_module_alias_duplicate, rhs);
851851
return false;
852852
}
853-
// Next, add the alias as a key and the underlying name as a value to the map
853+
// Next, add the alias as a key and the real name as a value to the map
854854
auto underlyingName = options.ModuleAliasMap.find(rhs)->first();
855855
if (!options.ModuleAliasMap.insert({lhs, underlyingName}).second) {
856856
diags.diagnose(SourceLoc(), diag::error_module_alias_duplicate, lhs);

test/Frontend/module-alias-invalid-input.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
// RUN: %target-swift-frontend -emit-silgen -parse-as-library %s -module-name foo -module-alias Bar=Swift -verify
99

1010
// RUN: not %target-swift-frontend -emit-silgen -parse-as-library %s -module-name foo -module-alias bar=bar 2>&1 | %FileCheck -check-prefix=INVALID_MODULE_ALIAS2 %s
11-
// INVALID_MODULE_ALIAS2: error: duplicate module alias; the name "bar" is already used for a module alias or an underlying name
11+
// INVALID_MODULE_ALIAS2: error: duplicate module alias; the name "bar" is already used for an alias or a real name
1212

1313
// RUN: not %target-swift-frontend -emit-silgen -parse-as-library %s -module-name foo -module-alias bar=baz -module-alias baz=cat 2>&1 | %FileCheck -check-prefix=INVALID_MODULE_ALIAS3 %s
14-
// INVALID_MODULE_ALIAS3: error: duplicate module alias; the name "baz" is already used for a module alias or an underlying name
14+
// INVALID_MODULE_ALIAS3: error: duplicate module alias; the name "baz" is already used for an alias or a real name
1515

1616
// RUN: not %target-swift-frontend -emit-silgen -parse-as-library %s -module-name foo -module-alias bar 2>&1 | %FileCheck -check-prefix=INVALID_MODULE_ALIAS4 %s
17-
// INVALID_MODULE_ALIAS4: error: invalid module alias format "bar"; make sure to use the format '-module-alias alias_name=underlying_name'
17+
// INVALID_MODULE_ALIAS4: error: invalid module alias format "bar"; make sure to use the format '-module-alias alias_name=real_name'
1818

1919
// RUN: not %target-swift-frontend -emit-silgen -parse-as-library %s -module-name foo -module-alias bar=c-a.t 2>&1 | %FileCheck -check-prefix=INVALID_MODULE_NAME %s
2020
// INVALID_MODULE_NAME: error: module name "c-a.t" is not a valid identifier

0 commit comments

Comments
 (0)