Skip to content

Commit 5008730

Browse files
committed
[cxx-interop] Link with CxxStdlib binary if it is available
The C++ standard library module `std` is being renamed to `CxxStdlib`, and `swiftstd` binary is being renamed to `swiftCxxStdlib`. This change teaches IRGen to link with the newly renamed binary.
1 parent 959216c commit 5008730

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/IRGen/GenDecl.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,8 +494,15 @@ void IRGenModule::emitSourceFile(SourceFile &SF) {
494494
// Do not try to link std with itself.
495495
if ((target.isOSDarwin() || target.isOSLinux()) &&
496496
!getSwiftModule()->getName().is("Cxx") &&
497-
!getSwiftModule()->getName().is("std"))
497+
!getSwiftModule()->getName().is("CxxStdlib") &&
498+
!getSwiftModule()->getName().is("std")) {
499+
// TODO: link with swiftCxxStdlib unconditionally once the overlay module
500+
// is renamed in CMake
501+
if (target.isOSDarwin())
502+
this->addLinkLibrary(
503+
LinkLibrary("swiftCxxStdlib", LibraryKind::Library));
498504
this->addLinkLibrary(LinkLibrary("swiftstd", LibraryKind::Library));
505+
}
499506
}
500507

501508
// FIXME: It'd be better to have the driver invocation or build system that

0 commit comments

Comments
 (0)