[interop][SwiftToCxx] add a Swift stdlib overlay header

It currently provides begin and end functions for array iteration
This commit is contained in:
Alex Lorenz
2022-09-29 07:34:31 -07:00
parent 599874a9f4
commit dd7e068391
8 changed files with 121 additions and 11 deletions

View File

@@ -759,6 +759,11 @@ EmittedClangHeaderDependencyInfo swift::printModuleContentsAsCxx(
OutputLanguageMode::Cxx);
writer.write();
info.dependsOnStandardLibrary = writer.isStdlibRequired();
if (M.isStdlibModule()) {
// Embed an overlay for the standard library.
ClangSyntaxPrinter(moduleOS).printIncludeForShimHeader(
"_SwiftStdlibCxxOverlay.h");
}
os << "#ifndef SWIFT_PRINTED_CORE\n";
os << "#define SWIFT_PRINTED_CORE\n";