Skip to content

Add @_used and @_section attributes to match #65901 #1710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CodeGeneration/Sources/SyntaxSupport/AttributeKinds.swift
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,16 @@ public let DECL_ATTR_KINDS: [Attribute] = [
className: "RuntimeMetadata",
swiftName: "runtimeMetadata"
),
SimpleDeclAttribute(
name: "_used",
className: "Used",
swiftName: "_used"
),
DeclAttribute(
name: "_section",
className: "Section",
swiftName: "_section"
),
]

/// Schema for declaration modifiers:
Expand Down
1 change: 1 addition & 0 deletions CodeGeneration/Sources/SyntaxSupport/KeywordSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public let KEYWORDS: [KeywordSpec] = [
KeywordSpec("_projectedValueProperty"),
KeywordSpec("_read"),
KeywordSpec("_RefCountedObject"),
KeywordSpec("_section"),
KeywordSpec("_semantics"),
KeywordSpec("_silgen_name"),
KeywordSpec("_specialize"),
Expand Down
7 changes: 7 additions & 0 deletions Sources/SwiftParser/Attributes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ extension Parser {
case _originallyDefinedIn
case _private
case _projectedValueProperty
case _section
case _semantics
case _silgen_name
case _specialize
Expand Down Expand Up @@ -81,6 +82,7 @@ extension Parser {
case TokenSpec(._originallyDefinedIn): self = ._originallyDefinedIn
case TokenSpec(._private): self = ._private
case TokenSpec(._projectedValueProperty): self = ._projectedValueProperty
case TokenSpec(._section): self = ._section
case TokenSpec(._semantics): self = ._semantics
case TokenSpec(._silgen_name): self = ._silgen_name
case TokenSpec(._specialize): self = ._specialize
Expand Down Expand Up @@ -120,6 +122,7 @@ extension Parser {
case ._originallyDefinedIn: return .keyword(._originallyDefinedIn)
case ._private: return .keyword(._private)
case ._projectedValueProperty: return .keyword(._projectedValueProperty)
case ._section: return .keyword(._section)
case ._semantics: return .keyword(._semantics)
case ._silgen_name: return .keyword(._silgen_name)
case ._specialize: return .keyword(._specialize)
Expand Down Expand Up @@ -305,6 +308,10 @@ extension Parser {
return parseAttribute(argumentMode: .required) { parser in
return .exposeAttributeArguments(parser.parseExposeArguments())
}
case ._section:
return parseAttribute(argumentMode: .required) { parser in
return .string(parser.parseStringLiteral())
}
case ._originallyDefinedIn:
return parseAttribute(argumentMode: .required) { parser in
return .originallyDefinedInArguments(parser.parseOriginallyDefinedInArguments())
Expand Down
4 changes: 4 additions & 0 deletions Sources/SwiftSyntax/generated/Keyword.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public enum Keyword: UInt8, Hashable {
case _projectedValueProperty
case _read
case _RefCountedObject
case _section
case _semantics
case _silgen_name
case _specialize
Expand Down Expand Up @@ -471,6 +472,8 @@ public enum Keyword: UInt8, Hashable {
self = ._forward
case "_private":
self = ._private
case "_section":
self = ._section
case "_Trivial":
self = ._Trivial
case "_version":
Expand Down Expand Up @@ -791,6 +794,7 @@ public enum Keyword: UInt8, Hashable {
"_projectedValueProperty",
"_read",
"_RefCountedObject",
"_section",
"_semantics",
"_silgen_name",
"_specialize",
Expand Down