Treat internally-imported bridging headers as internally-imported

When using an internal import for a bridging header, semantically treat
the contents of the bridging header, and anything that it imports, as
if they were imported internally. This is the actual semantic behavior
we wanted from internally-imported bridging headers.

This is the main semantic checking bit for rdar://74011750.
This commit is contained in:
Doug Gregor
2025-09-19 15:16:45 -07:00
parent 2383d7ab2d
commit b13c2aeccd
8 changed files with 59 additions and 18 deletions

View File

@@ -2991,7 +2991,9 @@ SourceFile::getImportAccessLevel(const ModuleDecl *targetModule) const {
// they are recommended over indirect imports.
if ((!restrictiveImport.has_value() ||
restrictiveImport->accessLevel < AccessLevel::Public) &&
imports.isImportedBy(targetModule, getParentModule()))
!(restrictiveImport &&
restrictiveImport->module.importedModule->isClangHeaderImportModule()) &&
imports.isImportedBy(targetModule, getParentModule()))
return std::nullopt;
return restrictiveImport;