-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[cxx-interop] Add friend operators to the lookup table properly #70325
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
egorzhdan
commented
Dec 8, 2023
@@ -8,6 +8,10 @@ | |||
// CHECK: mutating func callAsFunction(_ x: Int32) -> Int32 | |||
// CHECK: mutating func callAsFunction(_ x: Int32, _ y: Int32) -> Int32 | |||
// CHECK: } | |||
// CHECK: func == (lhs: LoadableIntWrapper, rhs: LoadableIntWrapper) -> Bool |
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.
A nice side effect of this change is that friend
operators now show up in the module interface.
@swift-ci please smoke test |
Previously, `friend` operators declared in C++ classes were added to the lookup table when the class is being imported. The operators were added to the wrong lookup table if the class is declared in a C++ namespace. Since a namespace can span across multiple Clang modules, its contents should be added to a translation unit level lookup table, not to a module level lookup table. This change makes sure we add `friend` operators to the lookup table earlier, when we are actually building the lookup table. Note that this is not possible for class template instantiations, because those are instantiated later, so for templates we still handle `friend` operators when importing the instantiation. rdar://116349899
e387670
to
c8017e7
Compare
@swift-ci please smoke test |
|
libc++ has decls that are declared outside of `inline namespace __1`, which might be printed before it.
@swift-ci please smoke test |
@swift-ci please smoke test macOS |
1 similar comment
@swift-ci please smoke test macOS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously,
friend
operators declared in C++ classes were added to the lookup table when the class is being imported.The operators were added to the wrong lookup table if the class is declared in a C++ namespace. Since a namespace can span across multiple Clang modules, its contents should be added to a translation unit level lookup table, not to a module level lookup table.
This change makes sure we add
friend
operators to the lookup table earlier, when we are actually building the lookup table. Note that this is not possible for class template instantiations, because those are instantiated later, so for templates we still handlefriend
operators when importing the instantiation.rdar://116349899