Skip to content

Conversation

@hnrklssn
Copy link
Member

This creates safe overloads for any methods in the protocol annotated with bounds information.
To support code sharing for both clang::FunctionDecl and clang::ObjCMethodDecl, swiftifyImpl is templated.
Updates _SwiftifyImportProtocol to make the added overloads in the protocol public.

rdar://144335990

...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
@hnrklssn
Copy link
Member Author

@swift-ci please smoke test

@hnrklssn
Copy link
Member Author

@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.
@hnrklssn
Copy link
Member Author

@swift-ci please smoke test

@hnrklssn
Copy link
Member Author

@swift-ci please smoke test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant