Skip to content

Commit e00e285

Browse files
author
Gabor Horvath
committed
[cxx-interop] Fix crash trying to export read accesors
This is not yet supported, so skip exporting those accessors for now. Fixes #77304 rdar://138944832
1 parent 09c89fb commit e00e285

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

lib/PrintAsClang/DeclAndTypePrinter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1949,8 +1949,9 @@ class DeclAndTypePrinter::Implementation
19491949

19501950
if (outputLang == OutputLanguageMode::Cxx) {
19511951
// FIXME: Documentation.
1952-
auto *getter = VD->getOpaqueAccessor(AccessorKind::Get);
1953-
printAbstractFunctionAsMethod(getter, /*isStatic=*/VD->isStatic());
1952+
// TODO: support read/modify accessors.
1953+
if (auto *getter = VD->getOpaqueAccessor(AccessorKind::Get))
1954+
printAbstractFunctionAsMethod(getter, /*isStatic=*/VD->isStatic());
19541955
if (auto *setter = VD->getOpaqueAccessor(AccessorKind::Set))
19551956
printAbstractFunctionAsMethod(setter, /*isStatic=*/VD->isStatic());
19561957
return;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// RUN: %empty-directory(%t)
2+
3+
// RUN: %target-swift-frontend -typecheck %s -typecheck -module-name UseSynchronization -enable-experimental-cxx-interop -clang-header-expose-decls=all-public -emit-clang-header-path %t/UseSynchronization.h
4+
// RUN: %FileCheck %s < %t/UseSynchronization.h
5+
6+
// REQUIRES: synchronization
7+
8+
import Synchronization
9+
10+
public class SomeClass { }
11+
12+
@available(macOS 15, iOS 18, tvOS 18, watchOS 11, visionOS 2, *)
13+
public class Thing {
14+
public static let rc = Mutex(SomeClass())
15+
}
16+
17+
// CHECK: class SWIFT_AVAILABILITY(visionos,introduced=2) SWIFT_AVAILABILITY(watchos,introduced=11) SWIFT_AVAILABILITY(tvos,introduced=18) SWIFT_AVAILABILITY(ios,introduced=18) SWIFT_AVAILABILITY(macos,introduced=15) SWIFT_SYMBOL("s:18UseSynchronization5ThingC") Thing;

0 commit comments

Comments
 (0)