Merge remote-tracking branch 'origin/main' into rebranch

This commit is contained in:
swift-ci
2025-08-06 22:35:25 -07:00
9 changed files with 62 additions and 174 deletions

View File

@@ -1156,14 +1156,11 @@ namespace {
return nullptr;
// If this is a top-level namespace, don't put it in the module we're
// importing, put it in the "__ObjC" module that is implicitly imported.
auto clangDC = decl->getDeclContext();
while (isa<clang::LinkageSpecDecl>(clangDC))
clangDC = clangDC->getParent();
if (!clangDC->isNamespace())
if (!decl->getParent()->isNamespace())
dc = Impl.ImportedHeaderUnit;
else {
// This is a nested namespace, so just lookup it's parent normally.
auto parentNS = cast<clang::NamespaceDecl>(clangDC);
auto parentNS = cast<clang::NamespaceDecl>(decl->getParent());
auto parent =
Impl.importDecl(parentNS, getVersion(), /*UseCanonicalDecl*/ false);
// The parent namespace might not be imported if it's `swift_private`.