Skip to content

Commit 2688154

Browse files
committed
Add @_objcImplementation attribute
Part of swiftlang/swift#60630, but safe to merge before the compiler-side implementation.
1 parent a31544a commit 2688154

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

Sources/SwiftParser/gyb_generated/DeclarationAttribute.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ extension Parser {
6464
case _staticInitializeObjCMetadata = "_staticInitializeObjCMetadata"
6565
case _restatedObjCConformance = "_restatedObjCConformance"
6666
case _typeSequence = "_typeSequence"
67+
case _objcImplementation = "_objcImplementation"
6768
case _optimize = "_optimize"
6869
case _clangImporterSynthesizedType = "_clangImporterSynthesizedType"
6970
case _weakLinked = "_weakLinked"

Tests/SwiftParserTest/Attributes.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,4 +238,15 @@ final class AttributeTests: XCTestCase {
238238
"""
239239
)
240240
}
241+
242+
func testObjcImplementationAttribute() throws {
243+
AssertParse("""
244+
@_objcImplementation extension MyClass {
245+
func fn() {}
246+
}
247+
@_objcImplementation(Category) extension MyClass {
248+
func fn2() {}
249+
}
250+
""")
251+
}
241252
}

gyb_syntax_support/AttributeKinds.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,11 @@ def __init__(self, name, swift_name=None):
399399
NotSerialized,
400400
ABIBreakingToAdd, ABIBreakingToRemove, APIBreakingToAdd, APIBreakingToRemove,
401401
code=71),
402-
# NOTE: 72 is unused
402+
DeclAttribute('_objcImplementation', 'ObjCImplementation',
403+
OnExtension,
404+
UserInaccessible,
405+
ABIBreakingToAdd, ABIBreakingToRemove, APIBreakingToAdd, APIBreakingToRemove,
406+
code=72),
403407
DeclAttribute('_optimize', 'Optimize',
404408
OnAbstractFunction, OnSubscript, OnVar,
405409
UserInaccessible,

0 commit comments

Comments
 (0)