Skip to content

Commit 4c135aa

Browse files
committed
Swift Bridging: add the SWIFT_IMPORT_UNSAFE macro
It's needed for C++ bridging functions which return types with pointers.
1 parent b11b897 commit 4c135aa

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

include/swift/Basic/Compiler.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@
8181
#define SWIFT_ATTRIBUTE_ALWAYS_INLINE
8282
#endif
8383

84+
// Needed for C++ bridging functions which return types with pointers.
85+
#if __has_attribute(swift_attr)
86+
#define SWIFT_IMPORT_UNSAFE __attribute__((swift_attr("import_unsafe")))
87+
#else
88+
#define SWIFT_IMPORT_UNSAFE
89+
#endif
90+
8491
#ifdef __GNUC__
8592
#define SWIFT_ATTRIBUTE_NORETURN __attribute__((noreturn))
8693
#elif defined(_MSC_VER)

0 commit comments

Comments
 (0)