[Serialization] Rewrite cross-references to private frameworks.

When serializing cross-references to a (private) module that is
re-exported through another (public) module, record the
cross-reference as if the entity were found in named public module.

Finishes rdar://problem/34438586.
This commit is contained in:
Doug Gregor
2017-09-12 16:42:28 -07:00
parent 919b6449a4
commit 27c8c4a8a1
3 changed files with 22 additions and 3 deletions

View File

@@ -23,7 +23,7 @@
#include "swift/ClangImporter/ClangImporter.h"
#include "swift/Serialization/BCReadingExtras.h"
#include "swift/Serialization/SerializedModuleLoader.h"
#include "clang/Basic/Module.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/OnDiskHashTable.h"
@@ -1563,6 +1563,15 @@ void ModuleFile::loadExtensions(NominalTypeDecl *nominal) {
if (nominal->getParent()->isModuleScopeContext()) {
Identifier moduleName = nominal->getParentModule()->getName();
// If the originating module is a private module whose interface is
// re-exported via public module, check the name of the public module.
if (auto clangModule
= nominal->getParentModule()->findUnderlyingClangModule()) {
if (!clangModule->ExportAsModule.empty())
moduleName = getContext().getIdentifier(clangModule->ExportAsModule);
}
for (auto item : *iter) {
if (item.first != moduleName.str())
continue;