@@ -1541,41 +1541,41 @@ void ModuleDependencyScanner::resolveSwiftOverlayDependenciesForModule(
1541
1541
recordResult (clangDep);
1542
1542
1543
1543
// C++ Interop requires additional handling
1544
- if ( ScanCompilerInvocation.getLangOptions ().EnableCXXInterop &&
1545
- moduleID.Kind == ModuleDependencyKind::SwiftInterface) {
1544
+ bool lookupCxxStdLibOverlay = ScanCompilerInvocation.getLangOptions ().EnableCXXInterop ;
1545
+ if (lookupCxxStdLibOverlay && moduleID.Kind == ModuleDependencyKind::SwiftInterface) {
1546
1546
const auto &moduleInfo = cache.findKnownDependency (moduleID);
1547
1547
const auto commandLine = moduleInfo.getCommandline ();
1548
-
1549
1548
// If the textual interface was built without C++ interop, do not query
1550
1549
// the C++ Standard Library Swift overlay for its compilation.
1551
1550
//
1552
- // FIXME: We always declare the 'Darwin' module as formally having been
1553
- // built without C++Interop, for compatibility with prior versions. Once we
1554
- // are certain that we are only building against modules built with support
1555
- // of
1556
- // '-formal-cxx-interoperability-mode', this hard-coded check should be
1557
- // removed.
1558
- if (moduleID.ModuleName != " Darwin" &&
1559
- llvm::find (commandLine, " -formal-cxx-interoperability-mode=off" ) ==
1560
- commandLine.end ()) {
1561
- for (const auto &clangDepName : allClangDependencies) {
1562
- // If this Clang module is a part of the C++ stdlib, and we haven't
1563
- // loaded the overlay for it so far, it is a split libc++ module (e.g.
1564
- // std_vector). Load the CxxStdlib overlay explicitly.
1565
- const auto &clangDepInfo =
1566
- cache.findDependency (clangDepName, ModuleDependencyKind::Clang)
1567
- .value ()
1568
- ->getAsClangModule ();
1569
- if (importer::isCxxStdModule (clangDepName, clangDepInfo->IsSystem ) &&
1570
- !swiftOverlayDependencies.contains (
1571
- {clangDepName, ModuleDependencyKind::SwiftInterface}) &&
1572
- !swiftOverlayDependencies.contains (
1573
- {clangDepName, ModuleDependencyKind::SwiftBinary})) {
1574
- scanForSwiftDependency (
1575
- getModuleImportIdentifier (ScanASTContext.Id_CxxStdlib .str ()));
1576
- recordResult (ScanASTContext.Id_CxxStdlib .str ().str ());
1577
- break ;
1578
- }
1551
+ // FIXME: We always declare the 'Darwin' module as formally having been built
1552
+ // without C++Interop, for compatibility with prior versions. Once we are certain
1553
+ // that we are only building against modules built with support of
1554
+ // '-formal-cxx-interoperability-mode', this hard-coded check should be removed.
1555
+ if (moduleID.ModuleName == " Darwin" ||
1556
+ llvm::find (commandLine, " -formal-cxx-interoperability-mode=off" ) !=
1557
+ commandLine.end ())
1558
+ lookupCxxStdLibOverlay = false ;
1559
+ }
1560
+
1561
+ if (lookupCxxStdLibOverlay) {
1562
+ for (const auto &clangDepName : allClangDependencies) {
1563
+ // If this Clang module is a part of the C++ stdlib, and we haven't
1564
+ // loaded the overlay for it so far, it is a split libc++ module (e.g.
1565
+ // std_vector). Load the CxxStdlib overlay explicitly.
1566
+ const auto &clangDepInfo =
1567
+ cache.findDependency (clangDepName, ModuleDependencyKind::Clang)
1568
+ .value ()
1569
+ ->getAsClangModule ();
1570
+ if (importer::isCxxStdModule (clangDepName, clangDepInfo->IsSystem ) &&
1571
+ !swiftOverlayDependencies.contains (
1572
+ {clangDepName, ModuleDependencyKind::SwiftInterface}) &&
1573
+ !swiftOverlayDependencies.contains (
1574
+ {clangDepName, ModuleDependencyKind::SwiftBinary})) {
1575
+ scanForSwiftDependency (
1576
+ getModuleImportIdentifier (ScanASTContext.Id_CxxStdlib .str ()));
1577
+ recordResult (ScanASTContext.Id_CxxStdlib .str ().str ());
1578
+ break ;
1579
1579
}
1580
1580
}
1581
1581
}
0 commit comments