-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[ClangImporter] Attach _SwiftifyImportProtocol to imported protocols with bounds attributes #85123
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
base: main
Are you sure you want to change the base?
Conversation
...with bounds attributes This creates safe overloads for any methods in the protocol annotated with bounds information. Updates _SwiftifyImportProtocol to make the added overloads in the protocol public. rdar://144335990
|
@swift-ci please smoke test |
|
@swift-ci please smoke test |
This updates SwiftifyImportProtocolPrinter such that it no longer emits
anything for methods without bounds or lifetime info. Previously we
would not attach the macro if no methods in the protocol contained
bounds or lifetime info. However if one of the methods did, we would
still emit `.method(signature: "func foo()", paramInfo: [])` for the
methods without bounds of lifetime info. This would result in overloads
being generated, like so:
```
@_alwaysEmitIntoClient @_disfavoredOverload public
func foo() {
return unsafe foo()
}
```
As part of this change, SwiftifyImportPrinter is now an abstract parent
type for SwiftifyImportProtocolPrinter, and the new
SwiftifyImportFunctionPrinter. Instead of SwiftifyImportProtocolPrinter
inheriting the function printing, `printMethod` instead creates a new
SwiftifyImportFunctionPrinter each time, with a new output string. If it
output anything interesting the result is forwarded, otherwise it is
discarded.
|
@swift-ci please smoke test |
1 similar comment
|
@swift-ci please smoke test |
|
@swift-ci please smoke test windows platform |
1 similar comment
|
@swift-ci please smoke test windows platform |
3b9ea2f to
1c0c558
Compare
|
@swift-ci please smoke test |
|
For a second I was questioning whether |
|
ping @egorzhdan @j-hui @DougGregor |
This creates safe overloads for any methods in the protocol annotated with bounds information.
To support code sharing for both
clang::FunctionDeclandclang::ObjCMethodDecl,swiftifyImplis templated.Updates _SwiftifyImportProtocol to make the added overloads in the protocol public.
rdar://144335990