|
1 | | -//===--- Attr.def - Swift Attributes Metaprogramming ------------*- C++ -*-===// |
| 1 | +//===--- DeclAttr.def - Swift Attributes Metaprogramming - ------*- C++ -*-===// |
2 | 2 | // |
3 | 3 | // This source file is part of the Swift.org open source project |
4 | 4 | // |
5 | | -// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors |
| 5 | +// Copyright (c) 2014 - 2024 Apple Inc. and the Swift project authors |
6 | 6 | // Licensed under Apache License v2.0 with Runtime Library Exception |
7 | 7 | // |
8 | 8 | // See https://swift.org/LICENSE.txt for license information |
9 | 9 | // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors |
10 | 10 | // |
11 | 11 | //===----------------------------------------------------------------------===// |
12 | 12 | // |
13 | | -// This file defines macros used for macro-metaprogramming with attributes. |
| 13 | +// This file defines macros used for macro-metaprogramming with decl attributes. |
14 | 14 | // |
15 | 15 | //===----------------------------------------------------------------------===// |
16 | 16 |
|
|
42 | 42 | DECL_ATTR_ALIAS(SPELLING, CLASS) |
43 | 43 | #endif |
44 | 44 |
|
45 | | -// A type attribute that is both a simple type attribute and a |
46 | | -// SIL type attribute (see below). Delegates to SIL_TYPE_ATTR if that |
47 | | -// is set and SIMPLE_TYPE_ATTR is not; otherwise delegates to SIMPLE_TYPE_ATTR. |
48 | | -#ifndef SIMPLE_SIL_TYPE_ATTR |
49 | | -#ifdef SIL_TYPE_ATTR |
50 | | -#ifdef SIMPLE_TYPE_ATTR |
51 | | -#error ambiguous delegation, must set SIMPLE_SIL_TYPE_ATTR explicitly |
52 | | -#else |
53 | | -#define SIMPLE_SIL_TYPE_ATTR(SPELLING, CLASS) SIL_TYPE_ATTR(SPELLING, CLASS) |
54 | | -#endif |
55 | | -#else |
56 | | -#define SIMPLE_SIL_TYPE_ATTR(SPELLING, CLASS) SIMPLE_TYPE_ATTR(SPELLING, CLASS) |
57 | | -#endif |
58 | | -#endif |
59 | | - |
60 | | -// Any kind of type attribute. |
61 | | -#ifndef TYPE_ATTR |
62 | | -#define TYPE_ATTR(SPELLING, CLASS) |
63 | | -#endif |
64 | | - |
65 | | -// A type attribute that is only valid in SIL mode. Usually this means |
66 | | -// that it's only valid in lowered types, but sometimes SIL files |
67 | | -// also allow things in formal types that aren't normally expressible. |
68 | | -#ifndef SIL_TYPE_ATTR |
69 | | -#define SIL_TYPE_ATTR(SPELLING, CLASS) TYPE_ATTR(SPELLING, CLASS) |
70 | | -#endif |
71 | | - |
72 | | -// A type attribute that's always just spelled `@identifier` in source. |
73 | | -#ifndef SIMPLE_TYPE_ATTR |
74 | | -#define SIMPLE_TYPE_ATTR(SPELLING, CLASS) TYPE_ATTR(SPELLING, CLASS) |
75 | | -#endif |
76 | | - |
77 | | - |
78 | | -// Type attributes |
79 | | -SIMPLE_TYPE_ATTR(autoclosure, Autoclosure) |
80 | | -TYPE_ATTR(convention, Convention) |
81 | | -SIMPLE_TYPE_ATTR(noescape, NoEscape) |
82 | | -SIMPLE_TYPE_ATTR(escaping, Escaping) |
83 | | -TYPE_ATTR(differentiable, Differentiable) |
84 | | -SIMPLE_TYPE_ATTR(noDerivative, NoDerivative) |
85 | | -SIMPLE_TYPE_ATTR(async, Async) |
86 | | -SIMPLE_TYPE_ATTR(Sendable, Sendable) |
87 | | -SIMPLE_TYPE_ATTR(retroactive, Retroactive) |
88 | | -SIMPLE_TYPE_ATTR(unchecked, Unchecked) |
89 | | -SIMPLE_TYPE_ATTR(preconcurrency, Preconcurrency) |
90 | | -SIMPLE_TYPE_ATTR(_local, Local) |
91 | | -SIMPLE_TYPE_ATTR(_noMetadata, NoMetadata) |
92 | | -TYPE_ATTR(_opaqueReturnTypeOf, OpaqueReturnTypeOf) |
93 | | - |
94 | | -// SIL-specific attributes |
95 | | -SIMPLE_SIL_TYPE_ATTR(block_storage, BlockStorage) |
96 | | -SIMPLE_SIL_TYPE_ATTR(box, Box) |
97 | | -SIMPLE_SIL_TYPE_ATTR(dynamic_self, DynamicSelf) |
98 | | -#define REF_STORAGE(Name, name, ...) SIMPLE_TYPE_ATTR(sil_##name, SIL##Name) |
99 | | -#include "swift/AST/ReferenceStorage.def" |
100 | | -SIMPLE_SIL_TYPE_ATTR(error, Error) |
101 | | -SIMPLE_SIL_TYPE_ATTR(error_indirect, ErrorIndirect) |
102 | | -SIMPLE_SIL_TYPE_ATTR(error_unowned, ErrorUnowned) |
103 | | -SIMPLE_SIL_TYPE_ATTR(out, Out) |
104 | | -SIMPLE_SIL_TYPE_ATTR(direct, Direct) |
105 | | -SIMPLE_SIL_TYPE_ATTR(in, In) |
106 | | -SIMPLE_SIL_TYPE_ATTR(inout, Inout) |
107 | | -SIMPLE_SIL_TYPE_ATTR(inout_aliasable, InoutAliasable) |
108 | | -SIMPLE_SIL_TYPE_ATTR(in_guaranteed, InGuaranteed) |
109 | | -SIMPLE_SIL_TYPE_ATTR(in_constant, InConstant) |
110 | | -SIMPLE_SIL_TYPE_ATTR(pack_owned, PackOwned) |
111 | | -SIMPLE_SIL_TYPE_ATTR(pack_guaranteed, PackGuaranteed) |
112 | | -SIMPLE_SIL_TYPE_ATTR(pack_inout, PackInout) |
113 | | -SIMPLE_SIL_TYPE_ATTR(pack_out, PackOut) |
114 | | -SIMPLE_SIL_TYPE_ATTR(owned, Owned) |
115 | | -SIMPLE_SIL_TYPE_ATTR(unowned_inner_pointer, UnownedInnerPointer) |
116 | | -SIMPLE_SIL_TYPE_ATTR(guaranteed, Guaranteed) |
117 | | -SIMPLE_SIL_TYPE_ATTR(autoreleased, Autoreleased) |
118 | | -SIMPLE_SIL_TYPE_ATTR(callee_owned, CalleeOwned) |
119 | | -SIMPLE_SIL_TYPE_ATTR(callee_guaranteed, CalleeGuaranteed) |
120 | | -SIMPLE_SIL_TYPE_ATTR(objc_metatype, ObjCMetatype) |
121 | | -SIL_TYPE_ATTR(opened, Opened) |
122 | | -SIL_TYPE_ATTR(pack_element, PackElement) |
123 | | -SIMPLE_SIL_TYPE_ATTR(pseudogeneric, Pseudogeneric) |
124 | | -SIMPLE_SIL_TYPE_ATTR(unimplementable, Unimplementable) |
125 | | -SIMPLE_SIL_TYPE_ATTR(yields, Yields) |
126 | | -SIMPLE_SIL_TYPE_ATTR(yield_once, YieldOnce) |
127 | | -SIMPLE_SIL_TYPE_ATTR(yield_many, YieldMany) |
128 | | -SIMPLE_SIL_TYPE_ATTR(captures_generics, CapturesGenerics) |
129 | | -// Used at the SIL level to mark a type as moveOnly. |
130 | | -SIMPLE_SIL_TYPE_ATTR(moveOnly, MoveOnly) |
131 | | -SIMPLE_SIL_TYPE_ATTR(isolated, Isolated) |
132 | | - |
133 | | -// SIL metatype attributes. |
134 | | -SIMPLE_SIL_TYPE_ATTR(thin, Thin) |
135 | | -SIMPLE_SIL_TYPE_ATTR(thick, Thick) |
136 | 45 |
|
137 | 46 | // Declaration Attributes and Modifers |
138 | 47 | DECL_ATTR(_silgen_name, SILGenName, |
@@ -574,10 +483,6 @@ SIMPLE_DECL_ATTR(_noObjCBridging, NoObjCBridging, |
574 | 483 | OnAbstractFunction | OnSubscript | UserInaccessible | ABIStableToAdd | ABIStableToRemove | APIStableToAdd | APIStableToRemove, |
575 | 484 | 155) |
576 | 485 |
|
577 | | -#undef SIMPLE_SIL_TYPE_ATTR |
578 | | -#undef SIMPLE_TYPE_ATTR |
579 | | -#undef SIL_TYPE_ATTR |
580 | | -#undef TYPE_ATTR |
581 | 486 | #undef DECL_ATTR_ALIAS |
582 | 487 | #undef CONTEXTUAL_DECL_ATTR_ALIAS |
583 | 488 | #undef SIMPLE_DECL_ATTR |
|
0 commit comments