[TBDGen] Add support for Objective-C Categories.

Emit Objective-C Categories for extensions that have the @objc attribute
directly (or indirectly via one of its methods, subscripts, etc) attached.

Also associate and emit all methods for that category into the API JSON file.

This fixes rdar://94734748.
This commit is contained in:
Juergen Ributzka
2022-06-23 09:19:05 -07:00
parent fb5ef6893d
commit a9e02e91cb
8 changed files with 247 additions and 46 deletions

View File

@@ -92,6 +92,7 @@ public class MyClass2 : NSObject {
// CHECK-NEXT: "classMethods": []
// CHECK-NEXT: }
// CHECK-NEXT: ],
// CHECK-NEXT: "categories": [],
// CHECK-NEXT: "version": "1.0"
// CHECK-NEXT: }
@@ -264,12 +265,12 @@ public class MyClass2 : NSObject {
// CHECK-SPI-NEXT: "super": "NSObject",
// CHECK-SPI-NEXT: "instanceMethods": [
// CHECK-SPI-NEXT: {
// CHECK-SPI-NEXT: "name": "init",
// CHECK-SPI-NEXT: "name": "spiMethod",
// CHECK-SPI-NEXT: "access": "private",
// CHECK-SPI-NEXT: "file": "/@input/MyModule.swiftmodule"
// CHECK-SPI-NEXT: },
// CHECK-SPI-NEXT: {
// CHECK-SPI-NEXT: "name": "spiMethod",
// CHECK-SPI-NEXT: "name": "init",
// CHECK-SPI-NEXT: "access": "private",
// CHECK-SPI-NEXT: "file": "/@input/MyModule.swiftmodule"
// CHECK-SPI-NEXT: }
@@ -284,18 +285,19 @@ public class MyClass2 : NSObject {
// CHECK-SPI-NEXT: "super": "NSObject",
// CHECK-SPI-NEXT: "instanceMethods": [
// CHECK-SPI-NEXT: {
// CHECK-SPI-NEXT: "name": "init",
// CHECK-SPI-NEXT: "access": "public",
// CHECK-SPI-NEXT: "name": "spiMethod",
// CHECK-SPI-NEXT: "access": "private",
// CHECK-SPI-NEXT: "file": "/@input/MyModule.swiftmodule"
// CHECK-SPI-NEXT: },
// CHECK-SPI-NEXT: {
// CHECK-SPI-NEXT: "name": "spiMethod",
// CHECK-SPI-NEXT: "access": "private",
// CHECK-SPI-NEXT: "name": "init",
// CHECK-SPI-NEXT: "access": "public",
// CHECK-SPI-NEXT: "file": "/@input/MyModule.swiftmodule"
// CHECK-SPI-NEXT: }
// CHECK-SPI-NEXT: ],
// CHECK-SPI-NEXT: "classMethods": []
// CHECK-SPI-NEXT: }
// CHECK-SPI-NEXT: ],
// CHECK-SPI-NEXT: "categories": [],
// CHECK-SPI-NEXT: "version": "1.0"
// CHECK-SPI-NEXT: }