[cxx-interop] Support foreing reference types in generic context

Print the type traits in reverse interop to enable the use of foreign
reference type in generics like Swift arrays. Also make sure optional
foreign reference types can be passed around as raw pointers.

rdar://108139769
This commit is contained in:
Gabor Horvath
2025-03-25 13:55:33 +00:00
parent a8111e4786
commit d631b9a3d2
4 changed files with 30 additions and 7 deletions

View File

@@ -579,8 +579,9 @@ public:
forwardDeclareCxxValueTypeIfNeeded(NTD);
else if (isa<StructDecl>(TD) && NTD->hasClangNode())
emitReferencedClangTypeMetadata(NTD);
else if (isa<ClassDecl>(TD) && TD->isObjC())
emitReferencedClangTypeMetadata(NTD);
else if (const auto *cd = dyn_cast<ClassDecl>(TD))
if (cd->isObjC() || cd->isForeignReferenceType())
emitReferencedClangTypeMetadata(NTD);
} else if (auto TAD = dyn_cast<TypeAliasDecl>(TD)) {
if (TAD->hasClangNode())
emitReferencedClangTypeMetadata(TAD);