Update module aliasing terms in diagnostics and comments

s/underlying_name/real_name

rdar://110028578
This commit is contained in:
Ellie Shin
2023-05-31 11:45:26 -07:00
parent 1864f12e09
commit 8c66776ce1
5 changed files with 11 additions and 11 deletions

View File

@@ -195,11 +195,11 @@ ERROR(error_empty_package_name,none,
ERROR(error_stdlib_not_found,Fatal,
"unable to load standard library for target '%0'", (StringRef))
ERROR(error_module_alias_invalid_format,none,
"invalid module alias format \"%0\"; make sure to use the format '-module-alias alias_name=underlying_name'", (StringRef))
"invalid module alias format \"%0\"; make sure to use the format '-module-alias alias_name=real_name'", (StringRef))
ERROR(error_module_alias_forbidden_name,none,
"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))
ERROR(error_module_alias_duplicate,none,
"duplicate module alias; the name \"%0\" is already used for a module alias or an underlying name", (StringRef))
"duplicate module alias; the name \"%0\" is already used for an alias or a real name", (StringRef))
ERROR(error_unable_to_load_supplementary_output_file_map, none,
"unable to load supplementary output file map '%0': %1",

View File

@@ -51,7 +51,7 @@ public:
/// An Objective-C header to import and make implicitly visible.
std::string ImplicitObjCHeaderPath;
/// The map of aliases and underlying names of imported or referenced modules.
/// The map of aliases and real names of imported or referenced modules.
llvm::StringMap<StringRef> ModuleAliasMap;
/// The name of the module that the frontend is building.

View File

@@ -520,8 +520,8 @@ def module_name_EQ : Joined<["-"], "module-name=">, Flags<[FrontendOption]>,
def module_alias : Separate<["-"], "module-alias">,
Flags<[FrontendOption, ModuleInterfaceOption]>,
MetaVarName<"<alias_name=underlying_name>">,
HelpText<"If a source file imports or references module <alias_name>, the <underlying_name> is used for the contents of the file">;
MetaVarName<"<alias_name=real_name>">,
HelpText<"If a source file imports or references module <alias_name>, the <real_name> is used for the contents of the file">;
def module_link_name : Separate<["-"], "module-link-name">,
Flags<[FrontendOption, ModuleInterfaceOption]>,

View File

@@ -831,7 +831,7 @@ bool ModuleAliasesConverter::computeModuleAliases(std::vector<std::string> args,
for (auto item: args) {
auto str = StringRef(item);
// splits to an alias and the underlying name
// splits to an alias and its real name
auto pair = str.split('=');
auto lhs = pair.first;
auto rhs = pair.second;
@@ -844,13 +844,13 @@ bool ModuleAliasesConverter::computeModuleAliases(std::vector<std::string> args,
return false;
}
// First, add the underlying name as a key to prevent it from being
// First, add the real name as a key to prevent it from being
// used as an alias
if (!options.ModuleAliasMap.insert({rhs, StringRef()}).second) {
diags.diagnose(SourceLoc(), diag::error_module_alias_duplicate, rhs);
return false;
}
// Next, add the alias as a key and the underlying name as a value to the map
// Next, add the alias as a key and the real name as a value to the map
auto underlyingName = options.ModuleAliasMap.find(rhs)->first();
if (!options.ModuleAliasMap.insert({lhs, underlyingName}).second) {
diags.diagnose(SourceLoc(), diag::error_module_alias_duplicate, lhs);

View File

@@ -8,13 +8,13 @@
// RUN: %target-swift-frontend -emit-silgen -parse-as-library %s -module-name foo -module-alias Bar=Swift -verify
// 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
// INVALID_MODULE_ALIAS2: error: duplicate module alias; the name "bar" is already used for a module alias or an underlying name
// INVALID_MODULE_ALIAS2: error: duplicate module alias; the name "bar" is already used for an alias or a real name
// 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
// INVALID_MODULE_ALIAS3: error: duplicate module alias; the name "baz" is already used for a module alias or an underlying name
// INVALID_MODULE_ALIAS3: error: duplicate module alias; the name "baz" is already used for an alias or a real name
// 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
// INVALID_MODULE_ALIAS4: error: invalid module alias format "bar"; make sure to use the format '-module-alias alias_name=underlying_name'
// INVALID_MODULE_ALIAS4: error: invalid module alias format "bar"; make sure to use the format '-module-alias alias_name=real_name'
// 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
// INVALID_MODULE_NAME: error: module name "c-a.t" is not a valid identifier