Skip to content

Commit 32a5b4f

Browse files
committed
Move "suppressible protocol" information into a separate .def file
We need to track suppressible protocols as part of metadata in the ABI.
1 parent 922e3da commit 32a5b4f

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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

include/swift/AST/KnownProtocols.def

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,10 @@ PROTOCOL(AsyncIteratorProtocol)
136136

137137
PROTOCOL(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+
141143
PROTOCOL_(BitwiseCopyable)
142144

143145
EXPRESSIBLE_BY_LITERAL_PROTOCOL(ExpressibleByArrayLiteral, "Array", false)

0 commit comments

Comments
 (0)