-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[cxx-interop] [nfc] Remove swift namespace from SwiftShims in C++ mode. #32715
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
Conversation
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.
To be more specific, the Swift
serialized module file contains references to symbols in SwiftShims headers. Since the standard library is built in default mode (without C++ interop) the symbols in SwiftShims headers are in the global namespace. When we enable C++ interop, it affects SwiftShims headers, too, and the symbols can't be found in the global namespace anymore. Therefore, the compiler can't deserialize certain parts of the Swift
module.
@zoecarver I'd appreciate if you could put that into your commit description for future readers.
@swift-ci Please test |
Build failed |
Build failed |
@gribozavr I would prefer if we just fix this here now. A force push doesn't hurt anyone and commit msgs are important; |
@gottesmm I'm in the process of rebasing/fixing the build errors now. Once that's done, I'll squash the commits and update the commit message. |
e8c01df
to
5183caf
Compare
@gottesmm @gribozavr I've updated the commit message. Sorry for the delay. I had to rebuild everything after updating checkouts, then had to update Xcode and rebuild everything again 🤦 |
@swift-ci please test. |
1 similar comment
@swift-ci please test. |
@swift-ci please test windows platform. |
@swift-ci please test Windows platform. |
Build failed |
5183caf
to
3948176
Compare
@swift-ci please smoke test |
@swift-ci please smoke test. |
Most SwiftShims were put in the swift namespace in C++ mode which broke certain things when importing them in a swift file in C++ mode. This was OK when they were only imported as part of the swift runtime but, now they are used in C++ mode both in the swift runtime and when C++ interop is enabled. This broke when C++ interop was enabled because the `Swift` module contains references to symbols in the SwiftShims headers which are built without C++ interop enabled (no "swift" namespace). But, when C++ interop is enabled, the SwiftShims headers would put everything in the swift namespace meaning the symbols couldn't be found in the global namespace. Then, the compiler would error when trying to deserialize the Swift module.
3948176
to
7f91f03
Compare
@swift-ci Please smoke test Linux platform |
@swift-ci please smoke test Linux platform. |
@swift-ci please smoke test Linux platform |
@swift-ci please smoke test OS X platform |
1 similar comment
@swift-ci please smoke test OS X platform |
I've updated the commit message. @gottesmm @gribozavr unless you want me to change the commit message further or have any other review comments, I'm going to plan to commit this tomorrow. |
LGTM, including the commit message! Please merge when you're ready. |
Most SwiftShims were put in the swift namespace in C++ mode which broke certain things when importing them in a swift file with C++ interop enabled. This was OK when they were only imported as part of the swift runtime but, now they are used in C++ mode both in the swift runtime and when C++ interop is enabled.