-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[MacrosOnImports][Swiftify] Copy module imports from clang node's module to its Swift macro SourceFile #81859
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
5539cec
to
7d2431e
Compare
@swift-ci please smoke test |
|
||
// CHECK: import ModuleA | ||
// CHECK-NEXT: import ModuleB | ||
// CHECK-NOT: import |
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.
@DougGregor I don't fully get why only the module's imports that themselves are top-level modules show up in the dump. It seems to work regardless, but it seems a bit off. Do you know if this is intended?
7d2431e
to
e5c5c6e
Compare
@swift-ci please smoke test |
e5c5c6e
to
229280f
Compare
@swift-ci please smoke test |
@swift-ci please smoke test windows |
@swift-ci please smoke test |
// RUN: %target-swift-ide-test -print-module -module-to-print=ClangIncludesNoExportModule -plugin-path %swift-plugin-dir -I %S/Inputs -source-filename=x -enable-experimental-feature SafeInteropWrappers | %FileCheck %s | ||
|
||
// swift-ide-test doesn't currently typecheck the macro expansions, so run the compiler as well | ||
// RUN: %target-swift-frontend -emit-module -plugin-path %swift-plugin-dir -o %t/ClangIncludesNoExport.swiftmodule -I %S/Inputs -enable-experimental-feature SafeInteropWrappers %s |
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 think it would be nice to have a run line with C++ interop enabled just in case. Sometimes there are subtle differences between the two modes.
@swift-ci please smoke test |
When macros like _SwiftifyImport are added to a wrapper module for a clang module, they may need to refer to symbols declared in another clang module that the wrapped module imports (e.g. because they are used in the original signature). This adds all the imported clang modules as implicit imports to the wrapper module. rdar://151611573
1b8ba84
to
7c794aa
Compare
@swift-ci please smoke test macos |
7c794aa
to
726d7b3
Compare
@swift-ci please smoke test macos |
726d7b3
to
b3c5489
Compare
@swift-ci please smoke test macos |
Since the _SwiftifyImport peer macro expansion reuses the function signature of the original imported function, it needs to import the same modules as the module where the original clang node resides, to ensure visibility of any symbols that may appear in the signature.
rdar://151611573