Merge pull request #39705 from apple/es-module-alias-serialize

[Module aliasing] Serialize SIL and binaries with module real names for referenced or imported modules. Resolves rdar://83632529
This commit is contained in:
Ellie Shin
2021-10-18 21:55:45 -07:00
committed by GitHub
20 changed files with 604 additions and 208 deletions

View File

@@ -1499,9 +1499,11 @@ ModuleDecl::ReverseFullNameIterator::ReverseFullNameIterator(
StringRef ModuleDecl::ReverseFullNameIterator::operator*() const {
assert(current && "all name components exhausted");
// Return the module's real (binary) name, which can be different from
// the name if module aliasing was used (-module-alias flag). The real
// name is used for serialization and loading.
if (auto *swiftModule = current.dyn_cast<const ModuleDecl *>())
return swiftModule->getName().str();
return swiftModule->getRealName().str();
auto *clangModule =
static_cast<const clang::Module *>(current.get<const void *>());