@@ -1408,39 +1408,41 @@ void ModuleDependencyScanner::resolveSwiftOverlayDependenciesForModule(
1408
1408
recordResult (clangDep);
1409
1409
1410
1410
// C++ Interop requires additional handling
1411
- if ( ScanCompilerInvocation.getLangOptions ().EnableCXXInterop &&
1412
- moduleID.Kind == ModuleDependencyKind::SwiftInterface) {
1411
+ bool lookupCxxStdLibOverlay = ScanCompilerInvocation.getLangOptions ().EnableCXXInterop ;
1412
+ if (lookupCxxStdLibOverlay && moduleID.Kind == ModuleDependencyKind::SwiftInterface) {
1413
1413
const auto &moduleInfo = cache.findKnownDependency (moduleID);
1414
1414
const auto commandLine = moduleInfo.getCommandline ();
1415
-
1416
1415
// If the textual interface was built without C++ interop, do not query
1417
1416
// the C++ Standard Library Swift overlay for its compilation.
1418
1417
//
1419
1418
// FIXME: We always declare the 'Darwin' module as formally having been built
1420
1419
// without C++Interop, for compatibility with prior versions. Once we are certain
1421
1420
// that we are only building against modules built with support of
1422
1421
// '-formal-cxx-interoperability-mode', this hard-coded check should be removed.
1423
- if (moduleID.ModuleName != " Darwin" &&
1424
- llvm::find (commandLine, " -formal-cxx-interoperability-mode=off" ) ==
1425
- commandLine.end ()) {
1426
- for (const auto &clangDepName : allClangDependencies) {
1427
- // If this Clang module is a part of the C++ stdlib, and we haven't
1428
- // loaded the overlay for it so far, it is a split libc++ module (e.g.
1429
- // std_vector). Load the CxxStdlib overlay explicitly.
1430
- const auto &clangDepInfo =
1431
- cache.findDependency (clangDepName, ModuleDependencyKind::Clang)
1432
- .value ()
1433
- ->getAsClangModule ();
1434
- if (importer::isCxxStdModule (clangDepName, clangDepInfo->IsSystem ) &&
1435
- !swiftOverlayDependencies.contains (
1436
- {clangDepName, ModuleDependencyKind::SwiftInterface}) &&
1437
- !swiftOverlayDependencies.contains (
1438
- {clangDepName, ModuleDependencyKind::SwiftBinary})) {
1439
- scanForSwiftDependency (
1440
- getModuleImportIdentifier (ScanASTContext.Id_CxxStdlib .str ()));
1441
- recordResult (ScanASTContext.Id_CxxStdlib .str ().str ());
1442
- break ;
1443
- }
1422
+ if (moduleID.ModuleName == " Darwin" ||
1423
+ llvm::find (commandLine, " -formal-cxx-interoperability-mode=off" ) !=
1424
+ commandLine.end ())
1425
+ lookupCxxStdLibOverlay = false ;
1426
+ }
1427
+
1428
+ if (lookupCxxStdLibOverlay) {
1429
+ for (const auto &clangDepName : allClangDependencies) {
1430
+ // If this Clang module is a part of the C++ stdlib, and we haven't
1431
+ // loaded the overlay for it so far, it is a split libc++ module (e.g.
1432
+ // std_vector). Load the CxxStdlib overlay explicitly.
1433
+ const auto &clangDepInfo =
1434
+ cache.findDependency (clangDepName, ModuleDependencyKind::Clang)
1435
+ .value ()
1436
+ ->getAsClangModule ();
1437
+ if (importer::isCxxStdModule (clangDepName, clangDepInfo->IsSystem ) &&
1438
+ !swiftOverlayDependencies.contains (
1439
+ {clangDepName, ModuleDependencyKind::SwiftInterface}) &&
1440
+ !swiftOverlayDependencies.contains (
1441
+ {clangDepName, ModuleDependencyKind::SwiftBinary})) {
1442
+ scanForSwiftDependency (
1443
+ getModuleImportIdentifier (ScanASTContext.Id_CxxStdlib .str ()));
1444
+ recordResult (ScanASTContext.Id_CxxStdlib .str ().str ());
1445
+ break ;
1444
1446
}
1445
1447
}
1446
1448
}
0 commit comments