Skip to content

Commit 9f9fdd9

Browse files
committed
[cxx-interop] Avoid treating some Obj-C types as foreign reference types
This makes sure we don't apply logic that is specific to C++ reference types to Objective-C types. Previously we were mistakenly treating some Objective-C types as foreign reference types. This meant that IRGen would try to emit calls to custom lifetime operations. This should not happen for non-C++ types. rdar://128447046
1 parent 764ba94 commit 9f9fdd9

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
@@ -6355,7 +6355,14 @@ bool ClassDecl::walkSuperclasses(
63556355
}
63566356

63576357
bool ClassDecl::isForeignReferenceType() const {
6358-
return getClangDecl() && isa<clang::RecordDecl>(getClangDecl());
6358+
auto clangRecordDecl = dyn_cast_or_null<clang::RecordDecl>(getClangDecl());
6359+
if (!clangRecordDecl)
6360+
return false;
6361+
6362+
CxxRecordSemanticsKind kind = evaluateOrDefault(
6363+
getASTContext().evaluator,
6364+
CxxRecordSemantics({clangRecordDecl, getASTContext()}), {});
6365+
return kind == CxxRecordSemanticsKind::Reference;
63596366
}
63606367

63616368
bool ClassDecl::hasRefCountingAnnotations() const {

0 commit comments

Comments
 (0)