Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/AST/ModuleDependencies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,8 @@ void swift::dependencies::registerCxxInteropLibraries(
return mainModuleName == Name;
})) {
// Only link with CxxStdlib on platforms where the overlay is available.
if (Target.isOSDarwin() || Target.isOSLinux() || Target.isOSWindows())
if (Target.isOSDarwin() || Target.isOSLinux() || Target.isOSWindows() ||
Target.isOSFreeBSD())
RegistrationCallback(LinkLibrary{"swiftCxxStdlib", LibraryKind::Library,
hasStaticCxxStdlib});
}
Expand Down
7 changes: 4 additions & 3 deletions lib/Driver/ToolChains.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1656,9 +1656,10 @@ const char *ToolChain::getClangLinkerDriver(
// a C++ standard library if it's not needed, in particular because the
// standard library that `clang++` selects by default may not be the one that
// is desired.
const char *LinkerDriver =
Args.hasArg(options::OPT_enable_experimental_cxx_interop) ? "clang++"
: "clang";
bool useCxxLinker = Args.hasArg(options::OPT_enable_experimental_cxx_interop);
if (Arg *arg = Args.getLastArg(options::OPT_cxx_interoperability_mode))
useCxxLinker |= StringRef(arg->getValue()) != "off";
const char *LinkerDriver = useCxxLinker ? "clang++" : "clang";
if (const Arg *A = Args.getLastArg(options::OPT_tools_directory)) {
StringRef toolchainPath(A->getValue());

Expand Down
3 changes: 2 additions & 1 deletion lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,8 @@ void CompilerInvocation::computeCXXStdlibOptions() {
// (see https://reviews.llvm.org/D101479).
LangOpts.CXXStdlib = CXXStdlibKind::Msvcprt;
LangOpts.PlatformDefaultCXXStdlib = CXXStdlibKind::Msvcprt;
} else if (LangOpts.Target.isOSLinux() || LangOpts.Target.isOSDarwin()) {
} else if (LangOpts.Target.isOSLinux() || LangOpts.Target.isOSDarwin() ||
LangOpts.Target.isOSFreeBSD()) {
auto [clangDriver, clangDiagEngine] =
ClangImporter::createClangDriver(LangOpts, ClangImporterOpts);
auto clangDriverArgs = ClangImporter::createClangArgs(
Expand Down
2 changes: 1 addition & 1 deletion test/Interop/Cxx/stdlib/avoid-import-cxx-math.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// RUN: %target-swift-frontend %s -typecheck -verify -cxx-interoperability-mode=swift-6
// RUN: %target-swift-frontend %s -typecheck -verify -cxx-interoperability-mode=upcoming-swift

// REQUIRES: OS=macosx || OS=linux-gnu
// REQUIRES: OS=macosx || OS=linux-gnu || OS=freebsd

import CxxStdlib

Expand Down
2 changes: 1 addition & 1 deletion test/Interop/Cxx/stdlib/overlay/custom-sequence.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -enable-experimental-cxx-interop)
//
// REQUIRES: executable_test
// REQUIRES: OS=macosx || OS=linux-gnu
// REQUIRES: OS=macosx || OS=linux-gnu || OS=freebsd

// REQUIRES: rdar102364960

Expand Down
2 changes: 1 addition & 1 deletion test/Interop/Cxx/stdlib/use-std-map.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

// REQUIRES: executable_test
//
// REQUIRES: OS=macosx || OS=linux-gnu
// REQUIRES: OS=macosx || OS=linux-gnu || OS=freebsd

import StdlibUnittest
#if !BRIDGING_HEADER
Expand Down