mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Jump through hoops to avoid adding a new Serialization -> clang::Module dependency.
This commit is contained in:
@@ -21,9 +21,9 @@
|
||||
#include "swift/AST/USRGeneration.h"
|
||||
#include "swift/Basic/Range.h"
|
||||
#include "swift/ClangImporter/ClangImporter.h"
|
||||
#include "swift/ClangImporter/ClangModule.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"
|
||||
@@ -1562,18 +1562,20 @@ void ModuleFile::loadExtensions(NominalTypeDecl *nominal) {
|
||||
}
|
||||
|
||||
if (nominal->getParent()->isModuleScopeContext()) {
|
||||
Identifier moduleName = nominal->getParentModule()->getName();
|
||||
auto parentModule = nominal->getParentModule();
|
||||
StringRef moduleName = parentModule->getName().str();
|
||||
|
||||
// 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);
|
||||
std::string exportedModuleName;
|
||||
if (auto clangModuleUnit =
|
||||
dyn_cast<ClangModuleUnit>(parentModule->getFiles().front())) {
|
||||
exportedModuleName = clangModuleUnit->getExportedModuleName();
|
||||
moduleName = exportedModuleName;
|
||||
}
|
||||
|
||||
for (auto item : *iter) {
|
||||
if (item.first != moduleName.str())
|
||||
if (item.first != moduleName)
|
||||
continue;
|
||||
Expected<Decl *> declOrError = getDeclChecked(item.second);
|
||||
if (!declOrError) {
|
||||
|
||||
Reference in New Issue
Block a user