Skip to content

Commit 617ead4

Browse files
committed
[interop][SwiftToCxx] do not emit _Concurrency APIs in the C++ section of the generated header
Fixes an issue where actors exposed its unownedExecutor property with unsupported type.
1 parent eba8a00 commit 617ead4

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lib/AST/SwiftNameTranslation.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,10 @@ bool swift::cxx_translation::isVisibleToCxx(const ValueDecl *VD,
239239
bool checkParent) {
240240
if (VD->isObjC())
241241
return false;
242+
// Do not expose anything from _Concurrency module yet.
243+
if (VD->getModuleContext()->ValueDecl::getName().getBaseIdentifier() ==
244+
VD->getASTContext().Id_Concurrency)
245+
return false;
242246
if (VD->getFormalAccess() >= minRequiredAccess) {
243247
return true;
244248
} else if (checkParent) {

test/Interop/SwiftToCxx/class/swift-actor-in-cxx.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
// RUN: %check-interop-cxx-header-in-clang(%t/actor.h)
66

7+
// RUN: %target-swift-frontend %s -typecheck -module-name Actor -emit-clang-header-path %t/actor-public.h -enable-experimental-cxx-interop -disable-availability-checking
8+
// RN: %FileCheck %s < %t/actor-public.h
9+
// RUN: %check-interop-cxx-header-in-clang(%t/actor-public.h)
10+
711
// RUN: %target-swift-frontend %s -typecheck -module-name Actor -enable-library-evolution -clang-header-expose-decls=has-expose-attr -emit-clang-header-path %t/actor-evo.h -disable-availability-checking
812
// RUN: %FileCheck %s < %t/actor-evo.h
913

0 commit comments

Comments
 (0)