-
Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathswift-interop-support.h
31 lines (27 loc) · 1.41 KB
/
swift-interop-support.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//===--- swift-interop-support.h - C++ and Swift Interop --------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// This file provides common utilities and annotations that are useful for C++
// codebases that interoperate with Swift.
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_CLANGIMPORTER_SWIFT_INTEROP_SUPPORT_H
#define SWIFT_CLANGIMPORTER_SWIFT_INTEROP_SUPPORT_H
#define SELF_CONTAINED __attribute__((swift_attr("import_owned")))
#define SAFE_TO_IMPORT __attribute__((swift_attr("import_unsafe")))
#define _CXX_INTEROP_STRINGIFY(_x) #_x
#define SWIFT_REFERENCE_TYPE(_retain, _release) \
__attribute__((swift_attr("import_reference"))) \
__attribute__((swift_attr(_CXX_INTEROP_STRINGIFY(retain:_retain)))) \
__attribute__((swift_attr(_CXX_INTEROP_STRINGIFY(release:_release))))
#define SWIFT_NAME(_name) __attribute__((swift_name(#_name)))
#endif // SWIFT_CLANGIMPORTER_SWIFT_INTEROP_SUPPORT_H