Skip to content

Commit 4a1662d

Browse files
authored
Merge pull request #73792 from apple/egorzhdan/is-frt-check
[cxx-interop] Avoid treating some Obj-C types as foreign reference types
2 parents 4221d9f + 9f9fdd9 commit 4a1662d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/AST/Decl.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6438,7 +6438,14 @@ bool ClassDecl::walkSuperclasses(
64386438
}
64396439

64406440
bool ClassDecl::isForeignReferenceType() const {
6441-
return getClangDecl() && isa<clang::RecordDecl>(getClangDecl());
6441+
auto clangRecordDecl = dyn_cast_or_null<clang::RecordDecl>(getClangDecl());
6442+
if (!clangRecordDecl)
6443+
return false;
6444+
6445+
CxxRecordSemanticsKind kind = evaluateOrDefault(
6446+
getASTContext().evaluator,
6447+
CxxRecordSemantics({clangRecordDecl, getASTContext()}), {});
6448+
return kind == CxxRecordSemanticsKind::Reference;
64426449
}
64436450

64446451
bool ClassDecl::hasRefCountingAnnotations() const {

0 commit comments

Comments
 (0)