Skip to content

[c++-interop] Teach APINotes to handle ObjCContainer items while in C++-Interop #4118

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

Merged
merged 1 commit into from
Apr 6, 2022
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ Name: CxxInterop
Classes:
- Name: NSSomeClass
SwiftName: SomeClass
Methods:
- Selector: 'didMoveToParentViewController:'
SwiftName: didMove(toParent:)
MethodKind: Instance
Enumerators:
- Name: SomeClassRed
SwiftName: red
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,12 @@
-(instancetype)init;
@end

// Extension, inspired by UIKit UIViewController.h
@interface NSSomeClass (UIContainerViewControllerCallbacks)

- (void)didMoveToParentViewController:(NSSomeClass *)parent;

@end

// Named "SomeClassRed" for ast node filtering in the test.
enum ColorEnum { SomeClassRed, SomeClassGreen, SomeClassBlue };
5 changes: 5 additions & 0 deletions clang/test/APINotes/objcxx-swift-name.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
// CHECK-NEXT: ObjCInterfaceDecl {{.+}} imported in CxxInteropKit <undeserialized declarations> NSSomeClass
// CHECK-NEXT: SwiftNameAttr {{.+}} <<invalid sloc>> "SomeClass"

// CHECK: Dumping NSSomeClass::didMoveToParentViewController::
// CHECK-NEXT: ObjCMethodDecl {{.+}} imported in CxxInteropKit - didMoveToParentViewController: 'void'
// CHECK-NEXT: ParmVarDecl
// CHECK-NEXT: SwiftNameAttr {{.+}} <<invalid sloc>> "didMove(toParent:)"

// CHECK: Dumping SomeClassRed:
// CHECK-NEXT: EnumConstantDecl {{.+}} imported in CxxInteropKit SomeClassRed 'ColorEnum'
// CHECK-NEXT: SwiftNameAttr {{.+}} <<invalid sloc>> "red"