[interop][SwiftToCxx] support std::string -> Swift::String conversion in C++

This commit is contained in:
Alex Lorenz
2022-12-13 07:11:42 -08:00
parent 7c2ee165cc
commit 5c703b4f5c
7 changed files with 68 additions and 5 deletions

View File

@@ -776,6 +776,10 @@ EmittedClangHeaderDependencyInfo swift::printModuleContentsAsCxx(
writer.write();
info.dependsOnStandardLibrary = writer.isStdlibRequired();
if (M.isStdlibModule()) {
// Embed additional STL includes.
os << "#ifndef SWIFT_CXX_INTEROP_HIDE_STL_OVERLAY\n";
os << "#include <string>\n";
os << "#endif\n";
// Embed an overlay for the standard library.
ClangSyntaxPrinter(moduleOS).printIncludeForShimHeader(
"_SwiftStdlibCxxOverlay.h");