-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[cxx-interop] Import attributes on inherited C++ methods #59022
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,94 @@ | ||
// RUN: %target-swift-ide-test -print-module -module-to-print=Functions -I %S/Inputs -source-filename=x -enable-experimental-cxx-interop | %FileCheck %s | ||
// RUN: %target-swift-ide-test -print-module -print-implicit-attrs -module-to-print=Functions -I %S/Inputs -source-filename=x -enable-experimental-cxx-interop | %FileCheck %s | ||
|
||
// CHECK: struct NonTrivial { | ||
// CHECK-NEXT: init() | ||
// CHECK-NEXT: @discardableResult | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like we're getting a lot of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think clang importer attaches In order to make the test less cluttered, we could switch to using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I see now. Thanks for explaining. Make sense. This LGTM. |
||
// CHECK-NEXT: func inNonTrivial() -> UnsafePointer<CChar>! | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: func inNonTrivialWithArgs(_ a: Int32, _ b: Int32) -> UnsafePointer<CChar>! | ||
// CHECK-NEXT: } | ||
|
||
// CHECK-NEXT: struct Base { | ||
// CHECK-NEXT: init() | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: mutating func mutatingInBase() -> UnsafePointer<CChar>! | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: func constInBase() -> UnsafePointer<CChar>! | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: func takesArgsInBase(_ a: Int32, _ b: Int32, _ c: Int32) -> UnsafePointer<CChar>! | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: func takesNonTrivialInBase(_ a: NonTrivial) -> UnsafePointer<CChar>! | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: func returnsNonTrivialInBase() -> NonTrivial | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: func templateInBase<T>(_ t: T) -> UnsafePointer<CChar>! | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: static func staticInBase() -> UnsafePointer<CChar>! | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: mutating func swiftRenamed(input i: Int32) -> Int32 | ||
// CHECK-NEXT: @available(swift, obsoleted: 3, renamed: "swiftRenamed(input:)") | ||
// CHECK-NEXT: mutating func renamed(_ i: Int32) -> Int32 | ||
// CHECK-NEXT: @_effects(readonly) func pure() | ||
// CHECK-NEXT: } | ||
|
||
// CHECK-NEXT: struct OtherBase { | ||
// CHECK-NEXT: init() | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: func inOtherBase() -> UnsafePointer<CChar>! | ||
// CHECK-NEXT: } | ||
|
||
// CHECK-NEXT: struct Derived { | ||
// CHECK-NEXT: init() | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: func inDerived() -> UnsafePointer<CChar>! | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: mutating func mutatingInBase() -> UnsafePointer<CChar>? | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: func constInBase() -> UnsafePointer<CChar>? | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: func takesArgsInBase(_ a: Int32, _ b: Int32, _ c: Int32) -> UnsafePointer<CChar>? | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: func takesNonTrivialInBase(_ a: NonTrivial) -> UnsafePointer<CChar>? | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: func returnsNonTrivialInBase() -> NonTrivial | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: mutating func swiftRenamed(input i: Int32) -> Int32 | ||
// CHECK-NEXT: @available(swift, obsoleted: 3, renamed: "swiftRenamed(input:)") | ||
// CHECK-NEXT: mutating func renamed(_ i: Int32) -> Int32 | ||
// CHECK-NEXT: @_effects(readonly) func pure() | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: func inOtherBase() -> UnsafePointer<CChar>? | ||
// CHECK-NEXT: } | ||
|
||
// CHECK-NEXT: struct DerivedFromDerived { | ||
// CHECK-NEXT: init() | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: func topLevel() -> UnsafePointer<CChar>! | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: func inDerived() -> UnsafePointer<CChar>? | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: mutating func mutatingInBase() -> UnsafePointer<CChar>? | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: func constInBase() -> UnsafePointer<CChar>? | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: func takesArgsInBase(_ a: Int32, _ b: Int32, _ c: Int32) -> UnsafePointer<CChar>? | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: func takesNonTrivialInBase(_ a: NonTrivial) -> UnsafePointer<CChar>? | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: func returnsNonTrivialInBase() -> NonTrivial | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: mutating func swiftRenamed(input i: Int32) -> Int32 | ||
// CHECK-NEXT: @available(swift, obsoleted: 3, renamed: "swiftRenamed(input:)") | ||
// CHECK-NEXT: mutating func renamed(_ i: Int32) -> Int32 | ||
// CHECK-NEXT: @_effects(readonly) func pure() | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: func inOtherBase() -> UnsafePointer<CChar>? | ||
// CHECK-NEXT: } | ||
|
||
// CHECK-NEXT: struct DerivedFromNonTrivial { | ||
// CHECK-NEXT: init() | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: func inNonTrivial() -> UnsafePointer<CChar>? | ||
// CHECK-NEXT: @discardableResult | ||
// CHECK-NEXT: func inNonTrivialWithArgs(_ a: Int32, _ b: Int32) -> UnsafePointer<CChar>? | ||
// CHECK-NEXT: } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking this might not always be
true
, maybe that's why we're seeing all the attrs in the test below. But I don't know.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to always inherit the attributes as
implicit
because we also inherit methods asimplicit
. Do you think that makes sense?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I see now. Sounds good.