Skip to content

Commit b5f8c79

Browse files
committed
move the lookup to the getRealName()
1 parent b00fcdc commit b5f8c79

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

Diff for: include/swift/AST/Module.h

-9
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,6 @@ class ModuleDecl
171171
/// The ABI name of the module, if it differs from the module name.
172172
mutable Identifier ModuleABIName;
173173

174-
/// The actual module name for an alias used for this module (if any).
175-
mutable Identifier ModuleRealName;
176-
177174
public:
178175
/// Produces the components of a given module's full name in reverse order.
179176
///
@@ -393,12 +390,6 @@ class ModuleDecl
393390
/// module if one exists.
394391
ModuleDecl *getUnderlyingModuleIfOverlay() const;
395392

396-
/// If a module alias is used, set the corresponding real name on disk,
397-
/// which will be used for contents including metadata and mangling.
398-
void setRealName(Identifier name) {
399-
ModuleRealName = name;
400-
}
401-
402393
public:
403394

404395
/// Returns true if this module is an underscored cross import overlay

Diff for: lib/AST/Module.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,6 @@ ModuleDecl::ModuleDecl(Identifier name, ASTContext &ctx,
476476
setImplicit();
477477
setInterfaceType(ModuleType::get(this));
478478
setAccess(AccessLevel::Public);
479-
setRealName(ctx.lookupModuleAlias(name));
480479

481480
Bits.ModuleDecl.StaticLibrary = 0;
482481
Bits.ModuleDecl.TestingEnabled = 0;
@@ -1565,9 +1564,8 @@ ImportedModule::removeDuplicates(SmallVectorImpl<ImportedModule> &imports) {
15651564
}
15661565

15671566
Identifier ModuleDecl::getRealName() const {
1568-
if (!ModuleRealName.empty())
1569-
return ModuleRealName;
1570-
return getName();
1567+
// This will return the real name for an alias (if used) or getName()
1568+
return getASTContext().lookupModuleAlias(getName());
15711569
}
15721570

15731571
Identifier ModuleDecl::getABIName() const {

0 commit comments

Comments
 (0)