mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Mark non-foreign entry points of @objc dynamic methods in generic classes dynamically_replaceable
```
class Generic<T> {
@objc dynamic func method() {}
}
extension Generic {
@_dynamicReplacement(for:method())
func replacement() {}
}
```
The standard mechanism of using Objective-C categories for dynamically
replacing @objc methods in generic classes does not work.
Instead we mark the native entry point as replaceable.
Because this affects all @objc methods in generic classes (whether there
is a replacement or not) by making the native entry point
`[dynamically_replaceable]` (regardless of optimization mode) we guard this by
the -enable-implicit-dynamic flag because we are late in the release cycle.
* Replace isNativeDynamic and isObjcDynamic by calls to shouldUse*Dispatch and
shouldUse*Replacement
This disambiguates between which dispatch method we should use at call
sites and how these methods should implement dynamic function
replacement.
* Don't emit the method entry for @_dynamicReplacement(for:) of generic class
methods
There is not way to call this entry point since we can't generate an
objective-c category for generic classes.
rdar://63679357
This commit is contained in:
@@ -690,6 +690,8 @@ FileUnit *SerializedModuleLoaderBase::loadAST(
|
||||
M.setTestingEnabled();
|
||||
if (extendedInfo.arePrivateImportsEnabled())
|
||||
M.setPrivateImportsEnabled();
|
||||
if (extendedInfo.isImplicitDynamicEnabled())
|
||||
M.setImplicitDynamicEnabled();
|
||||
|
||||
auto diagLocOrInvalid = diagLoc.getValueOr(SourceLoc());
|
||||
loadInfo.status =
|
||||
|
||||
Reference in New Issue
Block a user