Skip to content

Commit c5fa09c

Browse files
authored
Merge pull request #1176 from ahoppen/ahoppen/attributes
Re-model attribute parsing
2 parents b5bf778 + c9cbc40 commit c5fa09c

File tree

49 files changed

+7415
-6618
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+7415
-6618
lines changed

CodeGeneration/Sources/SyntaxSupport/AttributeKinds.swift.gyb

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -86,37 +86,6 @@ public let TYPE_ATTR_KINDS = [
8686
% end
8787
]
8888

89-
/// Schema for `DeclAttribute`s:
90-
///
91-
/// - Attribute name.
92-
/// - C++ class name without the 'Attr' suffix
93-
/// - Options for the attribute, including:
94-
/// * the declarations the attribute can appear on
95-
/// * whether duplicates are allowed
96-
/// - Unique attribute identifier used for serialization. This
97-
/// can never be changed.
98-
///
99-
/// SimpleDeclAttribute is the same, but the class becomes
100-
/// SimpleDeclAttr<DAK_##NAME> on the C++ side.
101-
///
102-
/// Please help ease code review/audits:
103-
/// - Please place the "OnXYZ" flags together on the next line.
104-
/// - Please place the non-OnXYZ flags together on the next to last line.
105-
/// - Please place the unique code number on the last line.
106-
/// - Please sort attributes by serialization number.
107-
/// - Please create a "NOTE" comment if a unique number is skipped.
108-
///
109-
/// If you're adding a new kind of "attribute" that is spelled without a leading
110-
/// '@' symbol, add an entry to the `DECL_MODIFIER_KINDS` array instead.
111-
///
112-
/// If you're adding a new underscored attribute here, please document it in
113-
/// docs/ReferenceGuides/UnderscoredAttributes.md.
114-
public let DECL_ATTR_KINDS: [Attribute] = [
115-
% for attr in DECL_ATTR_KINDS:
116-
${make_swift_attribute(attr)},
117-
% end
118-
]
119-
12089
/// Schema for declaration modifiers:
12190
///
12291
/// - Modifier name.

CodeGeneration/Sources/SyntaxSupport/KeywordSpec.swift

Lines changed: 5 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -38,61 +38,30 @@ public let KEYWORDS: [KeywordSpec] = [
3838
// Please keep these sorted alphabetically
3939

4040
KeywordSpec("__consuming"),
41-
KeywordSpec("__objc_bridged"),
4241
KeywordSpec("__owned"),
43-
KeywordSpec("__raw_doc_comment"),
4442
KeywordSpec("__setter_access"),
4543
KeywordSpec("__shared"),
46-
KeywordSpec("__synthesized_protocol"),
4744
KeywordSpec("_alignment"),
48-
KeywordSpec("_alwaysEmitConformanceMetadata"),
49-
KeywordSpec("_alwaysEmitIntoClient"),
50-
KeywordSpec("_assemblyVision"),
5145
KeywordSpec("_backDeploy"),
5246
KeywordSpec("_borrow"),
53-
KeywordSpec("_borrowed"),
5447
KeywordSpec("_cdecl"),
55-
KeywordSpec("_clangImporterSynthesizedType"),
5648
KeywordSpec("_Class"),
5749
KeywordSpec("_compilerInitialized"),
5850
KeywordSpec("_const"),
59-
KeywordSpec("_custom"),
60-
KeywordSpec("_disfavoredOverload"),
6151
KeywordSpec("_documentation"),
6252
KeywordSpec("_dynamicReplacement"),
63-
KeywordSpec("_eagerMove"),
6453
KeywordSpec("_effects"),
65-
KeywordSpec("_exported"),
6654
KeywordSpec("_expose"),
67-
KeywordSpec("_fixed_layout"),
68-
KeywordSpec("_forbidSerializingReference"),
6955
KeywordSpec("_forward"),
70-
KeywordSpec("_frozen"),
71-
KeywordSpec("_hasInitialValue"),
72-
KeywordSpec("_hasMissingDesignatedInitializers"),
73-
KeywordSpec("_hasStorage"),
74-
KeywordSpec("_implementationOnly"),
7556
KeywordSpec("_implements"),
76-
KeywordSpec("_implicitSelfCapture"),
77-
KeywordSpec("_inheritActorContext"),
78-
KeywordSpec("_inheritsConvenienceInitializers"),
7957
KeywordSpec("_linear"),
8058
KeywordSpec("_local"),
81-
KeywordSpec("_marker"),
8259
KeywordSpec("_modify"),
8360
KeywordSpec("_move"),
84-
KeywordSpec("_moveOnly"),
8561
KeywordSpec("_NativeClass"),
8662
KeywordSpec("_NativeRefCountedObject"),
87-
KeywordSpec("_noAllocation"),
88-
KeywordSpec("_noEagerMove"),
89-
KeywordSpec("_noImplicitCopy"),
90-
KeywordSpec("_noLocks"),
9163
KeywordSpec("_noMetadata"),
92-
KeywordSpec("_nonEphemeral"),
93-
KeywordSpec("_nonoverride"),
9464
KeywordSpec("_nonSendable"),
95-
KeywordSpec("_objc_non_lazy_realization"),
9665
KeywordSpec("_objcImplementation"),
9766
KeywordSpec("_objcRuntimeName"),
9867
KeywordSpec("_opaqueReturnTypeOf"),
@@ -103,25 +72,17 @@ public let KEYWORDS: [KeywordSpec] = [
10372
KeywordSpec("_projectedValueProperty"),
10473
KeywordSpec("_read"),
10574
KeywordSpec("_RefCountedObject"),
106-
KeywordSpec("_restatedObjCConformance"),
10775
KeywordSpec("_semantics"),
108-
KeywordSpec("_show_in_interface"),
10976
KeywordSpec("_silgen_name"),
11077
KeywordSpec("_specialize"),
111-
KeywordSpec("_specializeExtension"),
11278
KeywordSpec("_spi"),
11379
KeywordSpec("_spi_available"),
114-
KeywordSpec("_spiOnly"),
115-
KeywordSpec("_staticInitializeObjCMetadata"),
11680
KeywordSpec("_swift_native_objc_runtime_base"),
117-
KeywordSpec("_transparent"),
11881
KeywordSpec("_Trivial"),
11982
KeywordSpec("_TrivialAtMost"),
12083
KeywordSpec("_typeEraser"),
12184
KeywordSpec("_unavailableFromAsync"),
12285
KeywordSpec("_UnknownLayout"),
123-
KeywordSpec("_unsafeInheritExecutor"),
124-
KeywordSpec("_weakLinked"),
12586
KeywordSpec("actor"),
12687
KeywordSpec("addressWithNativeOwner"),
12788
KeywordSpec("addressWithOwner"),
@@ -136,6 +97,7 @@ public let KEYWORDS: [KeywordSpec] = [
13697
KeywordSpec("availability"),
13798
KeywordSpec("available"),
13899
KeywordSpec("await"),
100+
KeywordSpec("before"),
139101
KeywordSpec("break", isLexerClassified: true, requiresTrailingSpace: true),
140102
KeywordSpec("case", isLexerClassified: true, requiresTrailingSpace: true),
141103
KeywordSpec("catch", isLexerClassified: true, requiresLeadingSpace: true),
@@ -150,12 +112,9 @@ public let KEYWORDS: [KeywordSpec] = [
150112
KeywordSpec("derivative"),
151113
KeywordSpec("didSet"),
152114
KeywordSpec("differentiable"),
153-
KeywordSpec("discardableResult"),
154115
KeywordSpec("distributed"),
155116
KeywordSpec("do", isLexerClassified: true),
156117
KeywordSpec("dynamic"),
157-
KeywordSpec("dynamicCallable"),
158-
KeywordSpec("dynamicMemberLookup"),
159118
KeywordSpec("each"),
160119
KeywordSpec("else", isLexerClassified: true, requiresTrailingSpace: true),
161120
KeywordSpec("enum", isLexerClassified: true, requiresTrailingSpace: true),
@@ -168,25 +127,16 @@ public let KEYWORDS: [KeywordSpec] = [
168127
KeywordSpec("fileprivate", isLexerClassified: true, requiresTrailingSpace: true),
169128
KeywordSpec("final"),
170129
KeywordSpec("for", isLexerClassified: true, requiresTrailingSpace: true),
171-
KeywordSpec("frozen"),
172130
KeywordSpec("func", isLexerClassified: true, requiresTrailingSpace: true),
173131
KeywordSpec("get"),
174-
KeywordSpec("GKInspectable"),
175-
KeywordSpec("globalActor"),
176132
KeywordSpec("guard", isLexerClassified: true, requiresTrailingSpace: true),
177133
KeywordSpec("higherThan"),
178-
KeywordSpec("IBAction"),
179-
KeywordSpec("IBDesignable"),
180-
KeywordSpec("IBInspectable"),
181-
KeywordSpec("IBOutlet"),
182-
KeywordSpec("IBSegueAction"),
183134
KeywordSpec("if", isLexerClassified: true, requiresTrailingSpace: true),
184135
KeywordSpec("import", isLexerClassified: true, requiresTrailingSpace: true),
185136
KeywordSpec("in", isLexerClassified: true, requiresLeadingSpace: true, requiresTrailingSpace: true),
186137
KeywordSpec("indirect"),
187138
KeywordSpec("infix"),
188139
KeywordSpec("init", isLexerClassified: true, requiresTrailingSpace: true),
189-
KeywordSpec("inlinable"),
190140
KeywordSpec("inline"),
191141
KeywordSpec("inout", isLexerClassified: true, requiresTrailingSpace: true),
192142
KeywordSpec("internal", isLexerClassified: true, requiresTrailingSpace: true),
@@ -196,11 +146,11 @@ public let KEYWORDS: [KeywordSpec] = [
196146
KeywordSpec("kind"),
197147
KeywordSpec("lazy"),
198148
KeywordSpec("let", isLexerClassified: true, requiresTrailingSpace: true),
199-
KeywordSpec("LLDBDebuggerFunction"),
200149
KeywordSpec("lowerThan"),
201150
KeywordSpec("macro"),
202-
KeywordSpec("main"),
203151
KeywordSpec("message"),
152+
KeywordSpec("metadata"),
153+
KeywordSpec("module"),
204154
KeywordSpec("mutableAddressWithNativeOwner"),
205155
KeywordSpec("mutableAddressWithOwner"),
206156
KeywordSpec("mutating"),
@@ -210,12 +160,7 @@ public let KEYWORDS: [KeywordSpec] = [
210160
KeywordSpec("noescape"),
211161
KeywordSpec("nonisolated"),
212162
KeywordSpec("nonmutating"),
213-
KeywordSpec("nonobjc"),
214-
KeywordSpec("NSApplicationMain"),
215-
KeywordSpec("NSCopying"),
216-
KeywordSpec("NSManaged"),
217163
KeywordSpec("objc"),
218-
KeywordSpec("objcMembers"),
219164
KeywordSpec("obsoleted"),
220165
KeywordSpec("of"),
221166
KeywordSpec("open"),
@@ -225,29 +170,25 @@ public let KEYWORDS: [KeywordSpec] = [
225170
KeywordSpec("package"),
226171
KeywordSpec("postfix"),
227172
KeywordSpec("precedencegroup", isLexerClassified: true, requiresTrailingSpace: true),
228-
KeywordSpec("preconcurrency"),
229173
KeywordSpec("prefix"),
230174
KeywordSpec("private", isLexerClassified: true, requiresTrailingSpace: true),
231-
KeywordSpec("propertyWrapper"),
232175
KeywordSpec("Protocol"),
233176
KeywordSpec("protocol", isLexerClassified: true, requiresTrailingSpace: true),
234177
KeywordSpec("public", isLexerClassified: true, requiresTrailingSpace: true),
235178
KeywordSpec("reasync"),
236179
KeywordSpec("renamed"),
237180
KeywordSpec("repeat", isLexerClassified: true, requiresTrailingSpace: true),
238181
KeywordSpec("required"),
239-
KeywordSpec("requires_stored_property_inits"),
240-
KeywordSpec("resultBuilder"),
241182
KeywordSpec("rethrows", isLexerClassified: true, requiresTrailingSpace: true),
242183
KeywordSpec("return", isLexerClassified: true, requiresTrailingSpace: true),
243184
KeywordSpec("reverse"),
244-
KeywordSpec("runtimeMetadata"),
245185
KeywordSpec("safe"),
246186
KeywordSpec("self", isLexerClassified: true),
247187
KeywordSpec("Self", isLexerClassified: true),
248188
KeywordSpec("Sendable"),
249189
KeywordSpec("set"),
250190
KeywordSpec("some"),
191+
KeywordSpec("sourceFile"),
251192
KeywordSpec("spi"),
252193
KeywordSpec("spiModule"),
253194
KeywordSpec("static", isLexerClassified: true, requiresTrailingSpace: true),
@@ -257,27 +198,21 @@ public let KEYWORDS: [KeywordSpec] = [
257198
KeywordSpec("swift"),
258199
KeywordSpec("switch", isLexerClassified: true, requiresTrailingSpace: true),
259200
KeywordSpec("target"),
260-
KeywordSpec("testable"),
261201
KeywordSpec("throw", isLexerClassified: true, requiresTrailingSpace: true),
262202
KeywordSpec("throws", isLexerClassified: true, requiresTrailingSpace: true),
263203
KeywordSpec("transpose"),
264204
KeywordSpec("true", isLexerClassified: true),
265205
KeywordSpec("try", isLexerClassified: true, requiresTrailingSpace: true),
266206
KeywordSpec("Type"),
267207
KeywordSpec("typealias", isLexerClassified: true, requiresTrailingSpace: true),
268-
KeywordSpec("typeWrapper"),
269-
KeywordSpec("typeWrapperIgnored"),
270-
KeywordSpec("UIApplicationMain"),
271208
KeywordSpec("unavailable"),
272209
KeywordSpec("unchecked"),
273210
KeywordSpec("unowned"),
274211
KeywordSpec("unsafe"),
275-
KeywordSpec("unsafe_no_objc_tagged_pointer"),
276212
KeywordSpec("unsafeAddress"),
277213
KeywordSpec("unsafeMutableAddress"),
278-
KeywordSpec("usableFromInline"),
279214
KeywordSpec("var", isLexerClassified: true, requiresTrailingSpace: true),
280-
KeywordSpec("warn_unqualified_access"),
215+
KeywordSpec("visibility"),
281216
KeywordSpec("weak"),
282217
KeywordSpec("where", isLexerClassified: true, requiresLeadingSpace: true, requiresTrailingSpace: true),
283218
KeywordSpec("while", isLexerClassified: true, requiresTrailingSpace: true),

0 commit comments

Comments
 (0)