Skip to content

Commit b8b6d34

Browse files
authored
Merge pull request #84527 from hnrklssn/bridging-cleanup
[Interop] Bridging cleanup
2 parents 4f9c3d9 + 7576843 commit b8b6d34

File tree

1 file changed

+13
-14
lines changed
  • lib/ClangImporter/SwiftBridging/swift

1 file changed

+13
-14
lines changed

lib/ClangImporter/SwiftBridging/swift/bridging

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@
5151
/// automatic reference counting.
5252
///
5353
/// This example shows how to use this macro to let Swift know that
54-
/// a non-copyable reference counted C++ class can be imported as a reference counted type in Swift:
54+
/// a reference counted C++ class can be imported as a reference counted type in Swift:
5555
/// ```c++
5656
/// class SWIFT_SHARED_REFERENCE(retainSharedObject, releaseSharedObject)
57-
/// SharedObject : NonCopyable, IntrusiveReferenceCounted<SharedObject> {
57+
/// SharedObject : IntrusiveReferenceCounted<SharedObject> {
5858
/// public:
5959
/// static SharedObject* create();
6060
/// void doSomething();
@@ -71,7 +71,7 @@
7171
/// object.doSomething()
7272
/// // The Swift compiler will release object here.
7373
/// ```
74-
#define SWIFT_SHARED_REFERENCE(_retain, _release) \
74+
#define SWIFT_SHARED_REFERENCE(_retain, _release) \
7575
__attribute__((swift_attr("import_reference"))) \
7676
__attribute__((swift_attr(_CXX_INTEROP_STRINGIFY(retain:_retain)))) \
7777
__attribute__((swift_attr(_CXX_INTEROP_STRINGIFY(release:_release))))
@@ -82,10 +82,9 @@
8282
/// type in Swift.
8383
////
8484
/// This example shows how to use this macro to let Swift know that
85-
/// a non-copyable singleton C++ class can be imported as a reference type in Swift:
85+
/// a singleton C++ class can be imported as a reference type in Swift:
8686
/// ```c++
87-
/// class SWIFT_IMMORTAL_REFERENCE
88-
/// LoggerSingleton : NonCopyable {
87+
/// class SWIFT_IMMORTAL_REFERENCE LoggerSingleton {
8988
/// public:
9089
/// static LoggerSingleton &getInstance();
9190
/// void log(int x);
@@ -98,18 +97,18 @@
9897
/// let logger = LoggerSingleton.getInstance()
9998
/// logger.log(123)
10099
/// ```
101-
#define SWIFT_IMMORTAL_REFERENCE \
102-
__attribute__((swift_attr("import_reference"))) \
103-
__attribute__((swift_attr(_CXX_INTEROP_STRINGIFY(retain:immortal)))) \
104-
__attribute__((swift_attr(_CXX_INTEROP_STRINGIFY(release:immortal))))
100+
#define SWIFT_IMMORTAL_REFERENCE \
101+
__attribute__((swift_attr("import_reference"))) \
102+
__attribute__((swift_attr("retain:immortal"))) \
103+
__attribute__((swift_attr("release:immortal")))
105104

106105
/// Specifies that a `class` or `struct` is a reference type whose lifetime
107106
/// is not managed automatically. The programmer must validate that any reference
108107
/// to such object is valid themselves. This annotation lets Swift import such a type as a reference type in Swift.
109-
#define SWIFT_UNSAFE_REFERENCE \
110-
__attribute__((swift_attr("import_reference"))) \
111-
__attribute__((swift_attr(_CXX_INTEROP_STRINGIFY(retain:immortal)))) \
112-
__attribute__((swift_attr(_CXX_INTEROP_STRINGIFY(release:immortal)))) \
108+
#define SWIFT_UNSAFE_REFERENCE \
109+
__attribute__((swift_attr("import_reference"))) \
110+
__attribute__((swift_attr("retain:immortal"))) \
111+
__attribute__((swift_attr("release:immortal"))) \
113112
__attribute__((swift_attr("unsafe")))
114113

115114
/// Specifies a name that will be used in Swift for this declaration instead of its original name.

0 commit comments

Comments
 (0)