[Dependency Scanning][C++Interop] Do not query 'CxxStdlib' Swift overlay for textual modules which were not built with c++interop

When we discover a textual module dependency which is a module which was not originally built from source using C++ interop (specifying '-formal-cxx-interoperability-mode=off'), avoid looking up the C++ standard library Swift overlay for it. This is required for the case of the 'Darwin' module, for example, which includes headers which map to C++ stdlib headers when the compiler is operating in C++ interop mode, but the C++ standard library Swift overlay module itself depends on 'Darwin', which results in a cycle. To resolve such situations, we can rely on the fact that Swift textual interfaces of modules which were not built with C++ interop must be able to build without importing the C++ standard library Swift overlay, so we avoid specifying it as a dependency for such modules.

The primary source module, as well as Swift textual module dependencies which *were* built with C++ interop will continue getting a direct depedency of the 'CxxStdlib' Swift module.

Resolves rdar://150222155
This commit is contained in:
Artem Chikin
2025-05-09 12:20:22 -07:00
parent 97c5fbfe99
commit 7be7ab1e2b
4 changed files with 118 additions and 32 deletions

View File

@@ -933,7 +933,7 @@ generateFullDependencyGraph(const CompilerInstance &instance,
moduleInfo->details = getModuleDetails();
// Create a link libraries set for this module
auto &linkLibraries = moduleDependencyInfo.getLinkLibraries();
auto linkLibraries = moduleDependencyInfo.getLinkLibraries();
swiftscan_link_library_set_t *linkLibrarySet =
new swiftscan_link_library_set_t;
linkLibrarySet->count = linkLibraries.size();