|
| 1 | +// -*- C++ -*- |
1 | 2 | //===------------------ bridging - C++ and Swift Interop --------*- C++ -*-===//
|
2 | 3 | //
|
3 | 4 | // This source file is part of the Swift.org open source project
|
|
17 | 18 | #ifndef SWIFT_CLANGIMPORTER_SWIFT_INTEROP_SUPPORT_H
|
18 | 19 | #define SWIFT_CLANGIMPORTER_SWIFT_INTEROP_SUPPORT_H
|
19 | 20 |
|
| 21 | +#ifdef __has_attribute |
| 22 | +#define _CXX_INTEROP_HAS_ATTRIBUTE(x) __has_attribute(x) |
| 23 | +#else |
| 24 | +#define _CXX_INTEROP_HAS_ATTRIBUTE(x) 0 |
| 25 | +#endif |
| 26 | + |
| 27 | +#if _CXX_INTEROP_HAS_ATTRIBUTE(swift_attr) |
| 28 | + |
20 | 29 | /// Specifies that a C++ `class` or `struct` owns and controls the lifetime of all
|
21 | 30 | /// of the objects it references. Such type should not reference any objects whose
|
22 | 31 | /// lifetime is controlled externally. This annotation allows Swift to import methods
|
|
124 | 133 | #define SWIFT_COMPUTED_PROPERTY \
|
125 | 134 | __attribute__((swift_attr("import_computed_property")))
|
126 | 135 |
|
| 136 | +#else // #if _CXX_INTEROP_HAS_ATTRIBUTE(swift_attr) |
| 137 | + |
| 138 | +// Empty defines for compilers that don't support `attribute(swift_attr)`. |
| 139 | +#define SWIFT_SELF_CONTAINED |
| 140 | +#define SWIFT_RETURNS_INDEPENDENT_VALUE |
| 141 | +#define SWIFT_SHARED_REFERENCE(_retain, _release) |
| 142 | +#define SWIFT_IMMORTAL_REFERENCE |
| 143 | +#define SWIFT_UNSAFE_REFERENCE |
| 144 | +#define SWIFT_NAME(_name) |
| 145 | +#define SWIFT_CONFORMS_TO_PROTOCOL(_moduleName_protocolName) |
| 146 | +#define SWIFT_COMPUTED_PROPERTY |
| 147 | + |
| 148 | +#endif // #if _CXX_INTEROP_HAS_ATTRIBUTE(swift_attr) |
| 149 | + |
| 150 | +#undef _CXX_INTEROP_HAS_ATTRIBUTE |
| 151 | + |
127 | 152 | #endif // SWIFT_CLANGIMPORTER_SWIFT_INTEROP_SUPPORT_H
|
0 commit comments