File tree Expand file tree Collapse file tree 2 files changed +37
-2
lines changed Expand file tree Collapse file tree 2 files changed +37
-2
lines changed Original file line number Diff line number Diff line change 1+ // ===--- SuppressibleProtocols.def - Suppressible protocol meta -*- C++ -*-===//
2+ //
3+ // This source file is part of the Swift.org open source project
4+ //
5+ // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
6+ // Licensed under Apache License v2.0 with Runtime Library Exception
7+ //
8+ // See https://swift.org/LICENSE.txt for license information
9+ // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+ //
11+ // ===----------------------------------------------------------------------===//
12+ //
13+ // This file defines macros used for macro-metaprogramming with ABI-defined
14+ // suppressible protocols.
15+ //
16+ // The SUPPRESSIBLE_PROTOCOL(Name, Bit, MangleChar) macro is used to specify
17+ // each suppressible protocol that's conceptually part of the ABI. The
18+ // arguments are:
19+ // Name: The name of the protocol, e.g., Copyable
20+ // Bit: The bit in the set bitset of suppressible protocols that is used
21+ // to indicate this.
22+ // MangleChar: The character used for the name mangling to refer to this
23+ // protocol.
24+ // ===----------------------------------------------------------------------===//
25+
26+ #ifndef SUPPRESSIBLE_PROTOCOL
27+ # error Must define SUPPRESSIBLE_PROTOCOL macro before including this file
28+ #endif
29+
30+ SUPPRESSIBLE_PROTOCOL (Copyable, 0 , ' c' )
31+ SUPPRESSIBLE_PROTOCOL(Escapable, 1 , ' e' )
32+
33+ #undef SUPPRESSIBLE_PROTOCOL
Original file line number Diff line number Diff line change @@ -136,8 +136,10 @@ PROTOCOL(AsyncIteratorProtocol)
136136
137137PROTOCOL(FloatingPoint)
138138
139- INVERTIBLE_PROTOCOL_WITH_NAME(Copyable, " Copyable" )
140- INVERTIBLE_PROTOCOL_WITH_NAME(Escapable, " Escapable" )
139+ #define SUPPRESSIBLE_PROTOCOL (Name, Bit, MangleChar ) \
140+ INVERTIBLE_PROTOCOL_WITH_NAME (Name, #Name)
141+ #include " swift/ABI/SuppressibleProtocols.def"
142+
141143PROTOCOL_ (BitwiseCopyable)
142144
143145EXPRESSIBLE_BY_LITERAL_PROTOCOL(ExpressibleByArrayLiteral, " Array" , false )
You can’t perform that action at this time.
0 commit comments