Ignore transitive ObjC imports when cross-importing

This behavior change reduces the chance of unexpected and unwanted cross-imports being performed.

Fixes rdar://problem/60554019.
This commit is contained in:
Brent Royal-Gordon
2020-04-05 16:27:57 -07:00
parent 1d423e43c0
commit 121fa9a058
12 changed files with 72 additions and 23 deletions

View File

@@ -508,7 +508,7 @@ SourceLookupCache &ModuleDecl::getSourceLookupCache() const {
return *Cache;
}
ModuleDecl *ModuleDecl::getTopLevelModule() {
ModuleDecl *ModuleDecl::getTopLevelModule(bool overlay) {
// If this is a Clang module, ask the Clang importer for the top-level module.
// We need to check isNonSwiftModule() to ensure we don't look through
// overlays.
@@ -516,7 +516,8 @@ ModuleDecl *ModuleDecl::getTopLevelModule() {
if (auto *underlying = findUnderlyingClangModule()) {
auto &ctx = getASTContext();
auto *clangLoader = ctx.getClangModuleLoader();
return clangLoader->getWrapperForModule(underlying->getTopLevelModule());
return clangLoader->getWrapperForModule(underlying->getTopLevelModule(),
overlay);
}
}
// Swift modules don't currently support submodules.