@@ -503,24 +503,33 @@ swift::dependencies::checkImportNotTautological(const ImportPath::Module moduleP
503
503
return false ;
504
504
}
505
505
506
- void
507
- swift::dependencies::registerCxxInteropLibraries (
508
- const llvm::Triple &Target,
509
- StringRef mainModuleName,
510
- bool hasStaticCxx, bool hasStaticCxxStdlib, CXXStdlibKind cxxStdlibKind,
511
- std::function<void (const LinkLibrary&)> RegistrationCallback) {
512
- if (cxxStdlibKind == CXXStdlibKind::Libcxx)
513
- RegistrationCallback (LinkLibrary (" c++" , LibraryKind::Library));
514
- else if (cxxStdlibKind == CXXStdlibKind::Libstdcxx)
515
- RegistrationCallback (LinkLibrary (" stdc++" , LibraryKind::Library));
506
+ void swift::dependencies::registerCxxInteropLibraries (
507
+ const llvm::Triple &Target, StringRef mainModuleName, bool hasStaticCxx,
508
+ bool hasStaticCxxStdlib, CXXStdlibKind cxxStdlibKind,
509
+ std::function<void (const LinkLibrary &)> RegistrationCallback) {
510
+
511
+ switch (cxxStdlibKind) {
512
+ case CXXStdlibKind::Libcxx:
513
+ RegistrationCallback (
514
+ LinkLibrary{" c++" , LibraryKind::Library, /* static=*/ false });
515
+ break ;
516
+ case CXXStdlibKind::Libstdcxx:
517
+ RegistrationCallback (
518
+ LinkLibrary{" stdc++" , LibraryKind::Library, /* static=*/ false });
519
+ break ;
520
+ case CXXStdlibKind::Msvcprt:
521
+ // FIXME: should we be explicitly linking in msvcprt or will the module do
522
+ // so?
523
+ break ;
524
+ case CXXStdlibKind::Unknown:
525
+ // FIXME: we should probably emit a warning or a note here.
526
+ break ;
527
+ }
516
528
517
529
// Do not try to link Cxx with itself.
518
- if (mainModuleName != CXX_MODULE_NAME) {
519
- RegistrationCallback (LinkLibrary (Target.isOSWindows () && hasStaticCxx
520
- ? " libswiftCxx"
521
- : " swiftCxx" ,
522
- LibraryKind::Library));
523
- }
530
+ if (mainModuleName != CXX_MODULE_NAME)
531
+ RegistrationCallback (
532
+ LinkLibrary{" swiftCxx" , LibraryKind::Library, hasStaticCxx});
524
533
525
534
// Do not try to link CxxStdlib with the C++ standard library, Cxx or
526
535
// itself.
@@ -529,19 +538,9 @@ swift::dependencies::registerCxxInteropLibraries(
529
538
return mainModuleName == Name;
530
539
})) {
531
540
// Only link with CxxStdlib on platforms where the overlay is available.
532
- switch (Target.getOS ()) {
533
- case llvm::Triple::Win32: {
534
- RegistrationCallback (
535
- LinkLibrary (hasStaticCxxStdlib ? " libswiftCxxStdlib" : " swiftCxxStdlib" ,
536
- LibraryKind::Library));
537
- break ;
538
- }
539
- default :
540
- if (Target.isOSDarwin () || Target.isOSLinux ())
541
- RegistrationCallback (LinkLibrary (" swiftCxxStdlib" ,
542
- LibraryKind::Library));
543
- break ;
544
- }
541
+ if (Target.isOSDarwin () || Target.isOSLinux () || Target.isOSWindows ())
542
+ RegistrationCallback (LinkLibrary{" swiftCxxStdlib" , LibraryKind::Library,
543
+ hasStaticCxxStdlib});
545
544
}
546
545
}
547
546
@@ -569,7 +568,8 @@ swift::dependencies::registerBackDeployLibraries(
569
568
if (*compatibilityVersion > version)
570
569
return ;
571
570
572
- RegistrationCallback ({libraryName, LibraryKind::Library, forceLoad});
571
+ RegistrationCallback (
572
+ {libraryName, LibraryKind::Library, /* static=*/ true , forceLoad});
573
573
};
574
574
575
575
#define BACK_DEPLOYMENT_LIB (Version, Filter, LibraryName, ForceLoad ) \
0 commit comments