|
51 | 51 | /// automatic reference counting.
|
52 | 52 | ///
|
53 | 53 | /// 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: |
55 | 55 | /// ```c++
|
56 | 56 | /// class SWIFT_SHARED_REFERENCE(retainSharedObject, releaseSharedObject)
|
57 |
| -/// SharedObject : NonCopyable, IntrusiveReferenceCounted<SharedObject> { |
| 57 | +/// SharedObject : IntrusiveReferenceCounted<SharedObject> { |
58 | 58 | /// public:
|
59 | 59 | /// static SharedObject* create();
|
60 | 60 | /// void doSomething();
|
|
71 | 71 | /// object.doSomething()
|
72 | 72 | /// // The Swift compiler will release object here.
|
73 | 73 | /// ```
|
74 |
| -#define SWIFT_SHARED_REFERENCE(_retain, _release) \ |
| 74 | +#define SWIFT_SHARED_REFERENCE(_retain, _release) \ |
75 | 75 | __attribute__((swift_attr("import_reference"))) \
|
76 | 76 | __attribute__((swift_attr(_CXX_INTEROP_STRINGIFY(retain:_retain)))) \
|
77 | 77 | __attribute__((swift_attr(_CXX_INTEROP_STRINGIFY(release:_release))))
|
|
82 | 82 | /// type in Swift.
|
83 | 83 | ////
|
84 | 84 | /// 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: |
86 | 86 | /// ```c++
|
87 |
| -/// class SWIFT_IMMORTAL_REFERENCE |
88 |
| -/// LoggerSingleton : NonCopyable { |
| 87 | +/// class SWIFT_IMMORTAL_REFERENCE LoggerSingleton { |
89 | 88 | /// public:
|
90 | 89 | /// static LoggerSingleton &getInstance();
|
91 | 90 | /// void log(int x);
|
|
98 | 97 | /// let logger = LoggerSingleton.getInstance()
|
99 | 98 | /// logger.log(123)
|
100 | 99 | /// ```
|
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"))) |
105 | 104 |
|
106 | 105 | /// Specifies that a `class` or `struct` is a reference type whose lifetime
|
107 | 106 | /// is not managed automatically. The programmer must validate that any reference
|
108 | 107 | /// 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"))) \ |
113 | 112 | __attribute__((swift_attr("unsafe")))
|
114 | 113 |
|
115 | 114 | /// Specifies a name that will be used in Swift for this declaration instead of its original name.
|
|
0 commit comments