[interop][SwiftToCxx] pass / return Swift struct values between C/C++ and Swift

This commit is contained in:
Alex Lorenz
2022-06-08 07:00:47 -07:00
parent 1c76e22c84
commit 132729906c
25 changed files with 1360 additions and 54 deletions

View File

@@ -265,6 +265,9 @@ public:
forwardDeclare(ED);
} else if (isa<AbstractTypeParamDecl>(TD)) {
llvm_unreachable("should not see type params here");
} else if (isa<StructDecl>(TD)) {
// FIXME: add support here.
return;
} else {
assert(false && "unknown local type decl");
}
@@ -668,6 +671,7 @@ void swift::printModuleContentsAsCxx(
M.ValueDecl::getName().print(os);
os << " {\n";
os << "namespace " << cxx_synthesis::getCxxImplNamespaceName() << " {\n";
os << "extern \"C\" {\n";
os << "#endif\n\n";
os << prologueOS.str();
@@ -675,6 +679,7 @@ void swift::printModuleContentsAsCxx(
os << "\n#ifdef __cplusplus\n";
os << "}\n";
os << "}\n";
os << "}\n";
}
// Construct a C++ namespace for the module.