Skip to content

Make Objective-C interoperability configurable in the runtime #40927

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
Jan 21, 2022

Conversation

adrian-prantl
Copy link
Contributor

In order to be able to debug, for example, a Linux process from a macOS host, we
need to be able to initialize a ReflectionContext without Objective-C
interoperability. This patch turns ObjCInterOp into another template trait, so
it's possible to instantiate a non-ObjC MetadataReader on a system built with
ObjC-interop (but not vice versa).

This patch changes the class hierarchy to

                      TargetMetadata<Runtime>
                                |
                      TargetHeapMetadata<Runtime>
                                |
                      TargetAnyClassMetadata<Runtime>
                               /                \
                              /               TargetAnyClassMetadataObjCInterop<Runtime>
                             /                              \

TargetClassMetadata<Runtime, TargetAnyClassMetadata>

TargetClassMetadata<Runtime, TargetAnyClassMetadataObjCInterop>

TargetAnyClassMetadataObjCInterop inherits from TargetAnyClassMetadata because
most of the implementation is the same. This choice makes TargetClassMetadata a
bit tricky. In this patch I went with templating the parent class.

rdar://87179578

Relands #40843

@adrian-prantl
Copy link
Contributor Author

test with swiftlang/llvm-project#3823
@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 63d8228

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 63d8228

@adrian-prantl
Copy link
Contributor Author

test with swiftlang/llvm-project#3823
@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - b3b428b9d4df8d1b939a0215d80edc6cbd555be2

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - b3b428b9d4df8d1b939a0215d80edc6cbd555be2

In order to be able to debug, for example, a Linux process from a macOS host, we
need to be able to initialize a ReflectionContext without Objective-C
interoperability. This patch turns ObjCInterOp into another template trait, so
it's possible to instantiate a non-ObjC MetadataReader on a system built with
ObjC-interop (but not vice versa).

This patch changes the class hierarchy to

                          TargetMetadata<Runtime>
                                    |
                          TargetHeapMetadata<Runtime>
                                    |
                          TargetAnyClassMetadata<Runtime>
                                   /                \
                                  /               TargetAnyClassMetadataObjCInterop<Runtime>
                                 /                              \
TargetClassMetadata<Runtime, TargetAnyClassMetadata<Runtime>>    \
                                                                  \
                    TargetClassMetadata<Runtime, TargetAnyClassMetadataObjCInterop<Runtime>>

TargetAnyClassMetadataObjCInterop inherits from TargetAnyClassMetadata because
most of the implementation is the same. This choice makes TargetClassMetadata a
bit tricky. In this patch I went with templating the parent class.

rdar://87179578
@adrian-prantl
Copy link
Contributor Author

test with swiftlang/llvm-project#3823
@swift-ci test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - fede775

@adrian-prantl
Copy link
Contributor Author

test with swiftlang/llvm-project#3823
@swift-ci smoke test

@adrian-prantl adrian-prantl merged commit c65a469 into swiftlang:main Jan 21, 2022
etcwilde added a commit to etcwilde/swift that referenced this pull request Jan 21, 2022
…8-main"

This reverts commit c65a469, reversing
changes made to 42dca84.
compnerd added a commit to compnerd/apple-swift that referenced this pull request Jan 21, 2022
This fixes the build on Windows by fixing the template code.  The
template type was not qualified and caused an ambiguity in the name
resolution with the local typename and the previously declared
namespaced name.
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.

2 participants