[Importer] Ensure that we can see macro-expanded declarations in C++ namespaces

Lookup into C++ namespaces uses a different path from C++ record declarations.
Augment the C++ namespace lookup path to also account for the auxiliary
declarations introduced by peer macro expansions.
This commit is contained in:
Doug Gregor
2025-03-14 14:10:44 -07:00
parent e3618dd797
commit 84a4a8bedb
5 changed files with 95 additions and 29 deletions

View File

@@ -329,6 +329,11 @@ void swift::performImportResolutionForClangMacroBuffer(
ImportResolver resolver(SF);
resolver.addImplicitImport(clangModule);
// FIXME: This is a hack that we shouldn't need, but be sure that we can
// see the Swift standard library.
if (auto stdlib = SF.getASTContext().getStdlibModule())
resolver.addImplicitImport(stdlib);
SF.setImports(resolver.getFinishedImports());
SF.setImportedUnderlyingModule(resolver.getUnderlyingClangModule());