[cxx-interop] Fix a crash when exposing @objc Swift classes

rdar://154252454
This commit is contained in:
Gabor Horvath
2025-07-01 15:59:10 +01:00
parent 5a6a147850
commit 201e9b437c
2 changed files with 10 additions and 2 deletions

View File

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