[cxx-interop] Add -lc++ when C++ interop is enabled on Darwin.

This commit is contained in:
zoecarver
2022-01-17 11:58:30 -08:00
parent 323e2b16a7
commit ba44bfecce
2 changed files with 5 additions and 1 deletions

View File

@@ -468,6 +468,10 @@ void IRGenModule::emitSourceFile(SourceFile &SF) {
if (ObjCInterop)
this->addLinkLibrary(LinkLibrary("objc", LibraryKind::Library));
// Automatically with libc++ when possible.
if (Context.LangOpts.EnableCXXInterop && Context.LangOpts.Target.isOSDarwin())
this->addLinkLibrary(LinkLibrary("c++", LibraryKind::Library));
// FIXME: It'd be better to have the driver invocation or build system that
// executes the linker introduce these compatibility libraries, since at